Questions tagged [pyspark]
The Spark Python API (PySpark) exposes the apache-spark programming model to Python.
128
questions
0
votes
0
answers
10
views
Exploratory data analysis (EDA) on large dataset
I am working with lots of data (we have a table that produces 30 million rows daily).
What is the best way to explore it (do on EDA)?
Take a frictional slicing of the data randomly (100000 rows)
or ...
0
votes
1
answer
12
views
Does one-hot encode effects chi-square test?
I am doing a feature selection for a data science project with one of those feature being a high cardinality categorical variable (for context, it’s nationality). I know chi-square test could handle ...
0
votes
1
answer
8
views
Contunious model update
Hello I have a trained model on credit card fraud detection, however I want to find a solution so I can update the model parameters with new input records to simulate the pattern changes, is there any ...
0
votes
0
answers
5
views
Computing number of business days between start/end columns
I have two Dataframes
facts:
columns: data, start_date and end_date
holidays:
column: <...
0
votes
0
answers
11
views
PySpark createDataFrame() throws segmentation fault on Mac
I'm trying to learn PySpark. Finally got it installed following the tutorial here: https://sparkbyexamples.com/pyspark/install-pyspark-in-anaconda-jupyter-notebook/
However, even though I am now able ...
0
votes
0
answers
7
views
Is it possible to implement an rdd version of a for loop having map and reduce using pyspark?
I need to test an algorithm that computes a function on a dataframe where in each execution I drop a column and computes the function. This is a example in python pyspark but without using rdd:
...
0
votes
0
answers
15
views
Group a spark dataframe by a starting event to an ending event
Given a series of events (with datetime) such as:
failed, failed, passed, failed, passed, passed
I want to retrieve the time from when it first "failed" to when it first "passed," ...
0
votes
0
answers
35
views
Generalized Additive Modeling Apache Spark implementation
Does Spark MLlib support Generalized Additive Modeling? How does one go about implementing GAM models in Spark?
I want to implement GAM (Generalized additive model) model in Spark. Based on my ...
0
votes
0
answers
10
views
Feature engineering/selection within PySpark CrossValidator
Multiple sources I've read recently have argued that if using cross-validation to assist with model training/tuning, then aspects of the model development process such as feature selection should be ...
0
votes
0
answers
11
views
Is model training using spark ML distributed?
Is model training using spark ML distributed? If training happens on a single machine then why use spark?
0
votes
1
answer
24
views
CREATE TABLE USING Oracle DATA_SOURCE
I am trying to create a table using ORACLE as a data source using spark query but getting an error.
%sql
CREATE TABLE TEST
USING org.apache.spark.sql.jdbc
OPTIONS (
url "jdbc:oracle:thin:@...
0
votes
0
answers
32
views
Pyspark vs Pandas: When should we consider to change from Pandas to Pyspark
We trained a model in a single server using pandas, dataframe = 2.000.000 rows(I run it later in my own laptop), now we are migrating the code to the cloud and in that case to Databricks.
In ...
0
votes
0
answers
57
views
Creating table in Databricks using the table from Oracle
I am trying to create a table in Databricks using a object in Oracle Db, but getting an error
...
0
votes
1
answer
16
views
Best approach to find top-k most likely items
I am working with large datasets of papers and authors.
I am trying to find top-k authors that are likely to cite a new paper on the unseen dataset (https://www.aminer.org/aminernetwork).
My setup is ...
1
vote
0
answers
101
views
Huge matrix multiplication with PySpark
I am currently struggling with a problem. I have been googling around and cannot find an answer. Also I am kinda new to PySpark and Spark maybe that's why I am struggling.
Let's say I have a huge $m \...
1
vote
1
answer
71
views
How to get dummy variables from "first name"
I intend to predict the age of customers using some features. There are some categorical features that I need to convert to dummy variables before the modelling stage.
Since the datasets are so big (...
0
votes
0
answers
10
views
Data Pipelines - Apache Spark - Updating Another Data Store or Input to Queue
What is the correct way to think about or approach something like Spark breaking down a 160GB file into smaller manageable parts, or single records and then doing something like updating records in ...
0
votes
0
answers
14
views
How can improve the performance of clustering algorithm concerning similar/same records?
I want to check/experiment efficiency improvement of clustering algorithm under the title of Statistical preprocessing was done by including statistical frequency (counts) into dataframe concerning ...
0
votes
0
answers
31
views
Spark Dataframe APIs vs Spark SQL
I have a relatively complex query which runs against a database and contains multiple join statements, lead/lag functions, subquery, etc. These tables are available as individual files in my object ...
0
votes
0
answers
7
views
Is there a way to add custom (virtually all popular) metrics to BinaryClassificationEvaluator from pyspark MFlow library?
I am trying to make runs with mlflow from pyspark and I would like to obtain multiple metrics from that (not only ones suggested in the documentation which are areaUnderROC and areaUnderPR).
0
votes
0
answers
13
views
Analysing process data with sub groupings and checking for correlation
I have a dataset of process data for different equipment with many sensors. I would like to check the correlation of the different sensors to see if there is any strong correlation between some ...
0
votes
0
answers
88
views
How to implement predict_proba() with spark.ml logistic regression
In sklearn it is possible to use the predict_proba() function to obtain the probability matrix.
Since in ...
0
votes
0
answers
337
views
Access global variable from UDF (User Defined Function) in python in spark
I am trying to alter a global variable from inside a pyspark.sql.functions.udf function in python. But, the change in not getting reflected in the global variable.
...
1
vote
1
answer
108
views
PySpark for Big Data and RAM usage
I'm trying to figure out the best and most efficient method of handing ETL operations for big data. My question is this.
Say I have a table that is ~50 GB in size. In order to effectively transfer the ...
2
votes
1
answer
127
views
Where and how to do large scale supervised machine learning?
I'm beginner in ML and I have a large dataset that has 15 features with 6M rows, so it becomes challenging to work on it locally. I can train one model locally but to perform hyper parameter tuning ...
0
votes
1
answer
46
views
ML modeling a data with big amount of rows
I want to do ML modeling such XGboost, KNN, and similar models on data with 9 numerical features and more than 25 million rows and the size of data is almost 2.5 Gig and I prefer to use all the data ...
1
vote
0
answers
36
views
Why do I need to create a dataframe just to add a column? [closed]
So I worked with a bit of pandas and in that, it's easy to add a column to an existing dataframe. But in spark, a new dataframe needs to be created using 'withColumn'. I'm a complete newbie so is ...
1
vote
1
answer
59
views
Pyspark.read from MariaDB fetches duplicate header rows instead of data
It's a very strange issue- instead of fetching data like expected, it returns every row as a duplicate of the header. Every cell is a literal string of the column name.
If I don't use the query like ...
0
votes
1
answer
345
views
PySpark Crossvalidation error
I want to do a very simple cross validation using LogisticRegression.
Here is my code:
...
2
votes
1
answer
102
views
Spark: How to run PCA parallelized? Only one thread used
I use pySpark and set my configuration like following:
...
0
votes
0
answers
1k
views
multi-label prediction with pySpark
I am new to Spark
I am using pyspark to predict a multi label results.
I have converted multi labels to binary
So my labels will look like this
...
1
vote
2
answers
2k
views
PicklingError in pyspark (PicklingError: Can't pickle <class '__main__.Person'>: attribute lookup Person on __main__ failed)
I am unable to pickle the below class. I am using data bricks 6.5 ML (includes Apache Spark 2.4.5, Scala 2.11)
...
0
votes
1
answer
24
views
Creating more than one worker nodes for local windows machine [closed]
I am using windows laptop. And I installed apache spark for my laptop. And I try to measure spark performance by changing spark components. because of that I want to create more than one worker nodes ...
1
vote
3
answers
6k
views
Remove all columns where the entire column is null
I have a very dirty csv where there are several columns with only null values.
I would like to remove them. I am trying to select all columns where the count of null values in the column is not equal ...
0
votes
1
answer
102
views
How to run Spark python code in Jupyter Notebook via command prompt
I am trying to import a data frame into spark using Python's pyspark module. For this, I used Jupyter Notebook and executed the code shown in the screenshot below
After that I want to run this in CMD ...
1
vote
0
answers
1k
views
cannot access hive from spark [closed]
I am trying to install a hadoop + spark + hive cluster.
I am using hadoop 3.1.2, spark 2.4.5 (scala 2.11 prebuilt with user-provided hadoop) and hive 2.3.3 (also tried 3.1.2 with the exact same ...
0
votes
1
answer
267
views
Spark/Databricks: GPU does not appear to be utilized for ML regression (cross-validation, prediction) notebook
I have created and attached a notebook to a GPU-enabled Databricks cluster (6.4 ML (includes Apache Spark 2.4.5, GPU, Scala 2.11), EC2 type: p2.xlarge).
I have started running the notebook that ...
1
vote
1
answer
191
views
Pyspark Dataframes to Pandas and ML Ops - Parallel Execution Hold?
If I convert a spark dataframe into a pandas dataframe and subsequently apply pandas operations and sklearn models to the dataset in databricks, will the operations from pandas and sklearn be ...
2
votes
3
answers
1k
views
Is there a cost associated with converting Koalas dataframe to Spark dataframe?
I know that pandas works "under the hood" with numpy arrays stored in dictionaries. In contrast, Koalas works with the underlying Spark framework. Does that mean that there is no extra cost associated ...
1
vote
2
answers
969
views
PySpark: How do I specify dropna axis in PySpark transformation?
I would like to drop columns that contain all null values using dropna(). With Pandas you can do this with setting the keyword argument ...
0
votes
1
answer
393
views
How to apply K-Medoids in PySpark?
the pyspark ml library does not provide any clustering methods for K-Medoids. So my question is, how can one apply K-Medoids in a pyspark context?
1
vote
0
answers
20
views
Tool/Technology/Framework to process file with 1GB [closed]
I'm new to datascience, but I have the following problem:
1) Read a file of 1GB, which each line is a json object
2) There are two more files, much smaller, which I need to JOIN some data
In this ...
0
votes
1
answer
209
views
How to split a CSV into a dataframe without newline
Currently I'm using pyspark to make my df from a csv. However when I take the data in, it puts each element on a new line. Is there any way to keep the elements separate, and keep them on the same ...
1
vote
0
answers
402
views
Feature importance using logistic regression in pyspark
I am using logistic regression in PySpark. I have after splitting train and test dataset
...
0
votes
1
answer
201
views
Incremental modelling of kmeans in pyspark
I have a large dataset and trained the model with kmeans for the first time. I saved the model and pipeline used . Now again I started collecting data. After sufficient data is collected using old ...
2
votes
1
answer
545
views
Calculating Rank Ordering Error Metric for implicit recommendation
I'm reading Collaborative Filtering for Implicit Feedback Datasets. On page 6 they detail their evaluation strategy, which they define as mean Expected Percentile Ranking with the following formula:
$...
2
votes
1
answer
9k
views
How to select multiple columns in a RDD with Spark (pySpark)?
Lets say I have a RDD that has comma delimited data. Each comma delimited value represents the amount of hours slept in the day of a week.
So for i.e. [8,7,6,7,8,8,5]
How can I manipulate the RDD so ...
0
votes
2
answers
136
views
customer segmentation with unbalanced data
I am trying to do a customer segmentation on my transactional data and I am struggling a little bit on the best approach. Since it is an unsupervised model I can throw it to any algorithm and get some ...
0
votes
1
answer
205
views
Which ML method for multiclass (non-binary) text classification should I choose (from SparkML)?
I am working on a quite big dataset that will be processed on the cluster, so this is why I am using PySpark for that purpose.
The presentable records of this dataset have a such structure:
...
0
votes
1
answer
121
views
How to store subset of columns from a csv file?
I need to create a table in hive (or Impala) by reading from a csv file (named file.csv), ...