Questions tagged [python]

Use for data science questions related to the programming language Python. Not intended for general coding questions (-> stackoverflow).

Filter by
Sorted by
Tagged with
0
votes
1answer
33 views

How to get used to matricial/vectorial operations?

I came to data science/machine learning from another background in computer science and i feel that i'm lacking of experience with matricial/vectorial operations. Python or Matlab, for instance, ...
1
vote
0answers
14 views

Getting vague results using VAR time series forecasting in python!

Firstly, I am a beginner in this field of Data Science and have tried to implement some time series models for wind speed forecasting. Also, I am aware of the fact that some regression models might ...
2
votes
4answers
159 views

Is it possible to get worse model after optimization?

I am trying recently to optimize models but for some reason, whenever I try to run the optimization the model score in the end is worse than before, so I believe I do something wrong. in order to ...
1
vote
0answers
23 views

Getting inf% accuracy for Random Forest model with scikit learn

I have pandas dataframe with 8000 observations and with many different columns -some of them are dates and hours that were converted into dummies (get_dummies) and some are numerical,and y label which ...
4
votes
0answers
47 views

XGBoost skews towards minority class

I have a dataset with 85k positive labels and 53k negative labels. For this use-case, I am trying to maximize my efforts to the negative class (accurately identify true negatives, and minimize false ...
0
votes
0answers
27 views

Visualization of transformed features in BERT

So I'm trying the Intent Recognition with BERT using Keras and TensorFlow 2 available at kdnuggets.com and this is the code for the results evaluation. ...
1
vote
0answers
20 views

What's the order in applying SMOTE transformation in a pipeline?

Here's the thing, I have an imbalanced data and I was thinking about using SMOTE transformation. However, when doing that using a sklearn pipeline, I get an error because of missing values. This is my ...
2
votes
1answer
17 views

How to add Earlystopper in Classifier Model

I have designed the following Binary Classifier Neural Network Model for a task. I want to add an early stopper to the model so that the model stops at an epoch where it has stopped learning ...
0
votes
1answer
46 views

Hyperparameter Tuning in Random Forest Model

I'm new to the machine learning field, and I'm learning ML models by practice, and I'm facing an issue while using the machine learning model. While I'm implementing the ...
0
votes
0answers
721 views

Python: ValueError: Unknown layer: Functional

model_path = './models/VGG16_res.h5' model = load_model(model_path) This is the code which I'm using to load a model TensorFlow version: 2.3.0 I'm not sure ...
1
vote
1answer
46 views

Modifying binary classification to Multi-Class Classification (Logistic Regression) [closed]

I am using this code that I found here for logistic regression for binary classification with 2 classes. Git Repo The data that I am testing with is calling for multi-class classification (6 classes). ...
0
votes
1answer
34 views

How to use 5 by 5 or 7 by 7 kernel size for a deep learning network with 3 by 3 kernels?

I am using a U-Net architecture. The visual area of the segmentation mask is very small and after learning it is giving a lot of false positives. I am thinking of ...
0
votes
1answer
27 views

Determine relationship between users and age?

I would like to understand how to find an association between users, spam and email's age. My dataset looks like as follows: ...
0
votes
1answer
14 views

RandomizedSearchCV() not scoring all fits

I'm experiencing an issue with a RandomizedSearchCV grid that is not able to evaluate all of the fits. 50 of the 100 fits I'm calling do not get scored (score=nan), so I'm worried I'm wasting a bunch ...
2
votes
0answers
63 views

Which one to choose to identify patterns of user activity: Sequence analysis or process mining?

I have the following user activity data that where for each user the activity type they were engaged are recorded along with the phase: ...
0
votes
3answers
102 views

Why is the accuracy of a LinearSVC not the same as the SDGClassifier?

I'm fine tuning parameters for a linear support vector machine. There are multiple ways to do it, but I wanted to compare LinearSVC and SDGClassifier in terms of time. I expected the accuracy score to ...
1
vote
0answers
44 views

Support Vector Machines

I have ASCII data which converted from raster data in ArcGIS. I would like to use Support Vector Machine (SVM) algorithm to create a flood prediction map. My question is that can I use ASCII file ...
1
vote
0answers
31 views

Time series stationarize vs normalization

I have multiple time series coming from sensor measurements of an industrial machine. The industrial machine runs different 'Recipes'. Every recipe has different set of parameters which are set before ...
0
votes
0answers
9 views

split flattened tensor to perform class wise loss

I would like to adapt my dice loss function for multi-class averaging. y_true and y_pred are one-hot 3D images (mask of label). For example, if the flattened tensors contain the X classes sequentially,...
-3
votes
1answer
27 views

getting Index Error while accessing numpy array values using slicing [closed]

import numpy as np demo_matrix=np.array(([13,35.74,48],[23,37,37,38],[73,39,93,39])) demo_matrix[2,3] I'm getting Index Error when I tried to run this code. Can ...
0
votes
0answers
25 views

Difference between two images but in certain region only

I have two images, where i need to find the difference. i can easily did with the help of SSIM function. Now i want to find the difference between two images but only selected region (i want to ignore ...
1
vote
1answer
26 views

How should I sample from a mixture distribution?

Let's say we have a mixture distribution, defined by density $f(x)= w_1 p_1(x) + w_2 p_2(x)$, where $w_i$ is a scalar weight. Furthermore, we have efficient methods to evaluate the pdf and cdf/icdf ...
0
votes
0answers
151 views

How to fix IndexError: Too many levels: Index has only 1 level, not 2 in Python

I have written the following code that has a function model_data to perform a particular set of tasks. I have to pass the list of ...
0
votes
0answers
42 views

Are there specific feature engineering techniques for spectral data?

I am working on a model that takes 10 wavelengths (UV and NIR data) as input which measure the absorbances of a vegetable, to predict its nutritional density (protein, antioxidants, polyphenols) (...
0
votes
1answer
21 views

Finding sequences in two arrays [closed]

Imagine you have two arrays. arrayA = [1,2,4,1,3,9,8] arrayB = [4,3,2,4,1,3,9,8,9] and there's a sequence of numbers inside of them, if you look at arrayA then you ...
0
votes
1answer
24 views

how to build a lift chart using scikitplot

I am trying to build a lift chart using scikitplot library. I am getting the following can anyone guide with the error. please find the code with the error CODE: ...
0
votes
1answer
21 views

How to handle images of different sizes that are smaller than the input layer of a deep learning model?

I am performing human awareness detection and have trained my model using transfer learning with MobileNetV2. This model expects a tensor of dimension [Null,224,224,3]. I have applied face detection ...
2
votes
1answer
22 views

Issues with self-implemented logistic regression

I am trying to self-implement a logistic regression algorithm to do some self-learning but I am having a bit of trouble with achieving similar accuracy to the logistic regression of sklearn. Here is ...
0
votes
1answer
77 views

GridSearchCV() to fine tune outputs ValueError and FitFailedWarning

I want to fine tune some parameters for my linear SVM. This is the code: ...
0
votes
1answer
14 views

Including validation set in my code for a Linear SVM classifier returns a Type error

I'm using a predict function for a linear SVM classifier: ...
0
votes
0answers
12 views

Automatic EDA for BIG Data

I have data set of cicids2017 which in total has 2830743 rows and 79 columns. Since my local jupyter was crashing a lot, SO I am using Google Colab. But Google Colab is also crashing if some big ...
0
votes
1answer
18 views

AUC ROC Curve multi class Classification

Here is the part of the code for ROC AUC Curve calculation for multiple classes. ...
0
votes
0answers
9 views

ValueError: output_type='binary', but y.shape = (30, 3)

I have a custom estimator that i implemented myself and i am not able to use cross_val_score(), which i believe it has something to do with my ...
0
votes
1answer
27 views

How to include validation set in the pipeline to tune parameters for an SVM?

I have a dataset already divided into train, test and validation set. How can I insert the validation in my pipeline? Code: ...
0
votes
1answer
34 views

Python : Approaches to mine for time ordered sequences

I have a dataset that looks like this : ...
2
votes
0answers
34 views

Abnormal value of ROC AUC score in Binary Classifier Model

I have developed the following model for a Binary Classifier. I have to evluate using roc_auc_score. I am getting unusual values for ...
0
votes
1answer
106 views

MultiLabelBinarizer() with inverse_transform()

I have multilabel labels. Elements in a label mean voting. Here is how labels look: ...
0
votes
3answers
467 views

How to combine and separate test and train data for data cleaning?

I am working on an ML model in which I have been provided the data in 2 files test.csv and train.csv. I want to perform data ...
1
vote
0answers
25 views

Calculate the number of TP, FP, FN for the object detection task with many classes

I am trying to count the number of True Positives (TP), False Positives (FP), and False Negatives (FN) for object detection task with two classes. I assumed that: TP - is the detection with ...
1
vote
0answers
10 views

How to find average of Duplicate Column Headers in Python dataframe [closed]

I have data in this format ...
3
votes
2answers
71 views

How can I determine the relationship between spam and weekdays?

I am trying to check if there is a correlation between spam emails and weekdays. My dataset looks like as follows: ...
1
vote
0answers
28 views

Reinforcement Learning for classification of a CSV file

I would like to try a Reinforcement Learning approach for a multi-label or binary classification of a CSV file. I know that Supervised Learning is probably easier and I have already tried a couple of ...
2
votes
1answer
68 views

Loss function for age classification

I am building a CNN model for age classification. Assuming age of a person is between 1-100, my last Linear Layer contains 100 output neuron. Now i want to find an appropriate loss function for this ...
1
vote
2answers
234 views

How to predict multiple images from folder in python

Here is the code for the Prediction of multiple images from the folder. But getting the same label(class) for all the images.I'm not able to find out why every image shows the same label. ...
0
votes
0answers
8 views

How to Convolve a High-Res Image by a (fully convolutional) CNN kernel?

My CNN is an extremely simple neural network. ...
0
votes
1answer
32 views

Book suggestions [closed]

Considering, I do have some knowledge about machine learning, python, data science through the courses I have done from sites like Udemy, Udacity, Edx. However, I would like to read some books related ...
0
votes
1answer
29 views

Encoding categorical data with pre-determined dictionary

in case feature encoding, if I'd like to encode my values based on my pre-determined dictionary, how do I do that? For instance, say, I've values as ...
0
votes
2answers
80 views

sklearn - How to create a sequential pipeline

Update: The examples in this post were updated I am reposting this question here after not getting a clear answer in a previous SO post I am looking for a help building a data preprocessing pipleline ...
1
vote
1answer
28 views

Count occurences of rows based one cell content with pandas [closed]

I am currently struggling with the pandas framework. Let's imagine the following Data Frame: ...
0
votes
1answer
23 views

Time series plot using netcdf data in python

I am trying to plot a time series for a 3d plot. I know that the variable must be made 1d inorder to make it viable for the time series plot. Actually I want the data within a box of latitude and ...

1
3 4
5
6 7
97