Questions tagged [scikit-learn]

For questions related to the Python's package scikit-learn (or sklearn).

Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

How to make a RandomForestRegressor learn to differentiatie similar inputs with different outputs?

I'm working on a regression task with Sklearn RandomForestRegressor and I'm having some trouble distinguishing between two similar data with very different expected outputs. For example, each pair of ...
Luís Henrique Bandória's user avatar
0 votes
0 answers
19 views

Confusion about the code for choosing "stumps" in Adaboost algorithm

(I actually asked the following question on Stack Overflow and Cross Validated Exchange for more than a month: https://stackoverflow.com/questions/76842431/confusion-about-the-code-for-choosing-...
Richard's user avatar
  • 101
0 votes
2 answers
317 views

I'm trying to understand the use model for different Python libraries

I'm new to ML/AI field, and after completing several free university courses from MIT OpenCourseWare and Harvard CS50, I've gained some familiarity with the theoretical foundations of Artificial ...
Boris L.'s user avatar
  • 109
0 votes
1 answer
78 views

cross_val_score of sklearn and LinearRegression scoring method

cross_val_score (https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_val_score.html) uses the estimator’s default scorer (if available) and LinearRgression (the estimator I ...
FluidMechanics Potential Flows's user avatar
0 votes
1 answer
110 views

Can I implement a sklearn model inside a Pytorch nn.Module? [closed]

I am making a custom Pytorch model that at some point, clusters a latent space that was created by another, previous routine of the model (Autoencoder). In a bit more detail, my model is a regular ...
puradrogasincortar's user avatar
0 votes
1 answer
31 views

How to convert my test data in the same dimensionality as my train data

I have trained a VAE with jpg images. My latent space dimension has 768 features and when plotting the latent space it looks like this: However, when I use the scikit learn tool LDA (Linear ...
Dude Rar's user avatar
1 vote
0 answers
44 views

Using ML to uncover procedural logic

The game Elite Dangerous has a proceduraly generated galaxy of some 400 billion star systems. Each star system in the game can be uniquely identified bu a 64bit number (id64) which is used as a seed ...
Paulo Rodrigues's user avatar
0 votes
1 answer
202 views

Why does KNN Model return 99% accuracy on dataset with default parameters? [closed]

I am building a model that predicts if a user will like a stock or not based on different features, such as Market Cap, Current Ratio, Sector, Trailing PE, etc. I am going to implement this model in a ...
Messi10's user avatar
0 votes
1 answer
55 views

How to evaluate binary classifier on imbalanced dataset?

I have trained a Decision Tree model on an imbalanced dataset. I got the following results for the test set from the sklearn and imblearn classification reports (attached below). Moreover, the other ...
Zal's user avatar
  • 7
1 vote
1 answer
18 views

Unexpected behaviour on using class weights in loss

I’m working on a classification problem (500 classes). My NN has 3 fully connected layers, followed by an LSTM layer. I use nn.CrossEntropyLoss() as my loss function. To tackle the problem of class ...
helloworld's user avatar
0 votes
1 answer
146 views

How to interpret binary classification metrics on an imbalanced data set?

I have an imbalanced dataset on intrusion detection. I have (attack class) 3668045 samples and (benign class) 477 samples. I made a 70:30 Train test split. My problem is to predict whether the given ...
Zal's user avatar
  • 7
0 votes
1 answer
444 views

Why does GridSearchCV model give worse results despite same parameters used with base model

I am trying to make prediction using random forest regression and then utilize GridSearchCV to tune hyperparameters(just 'n_estimators'). However results of GridSearchCV are worse than base model. ...
dancineer's user avatar
1 vote
1 answer
167 views

Why does sklearn perceptron converge for linearly inseparable data points?

I learned that the perceptron algorithm only converges if the dataset is linearly separable. I am implementing this algorithm using scikit learn. The blue and orange points are from the training set, ...
jacquesadit00's user avatar
0 votes
1 answer
44 views

'Advancing' basic models

Good morning. I am a student running a project using medical data, predicting if the patient will or won't get a disease. The data has about 50k cases and 70 features. I proposed to train 5 models- ...
helpwithkeras's user avatar
0 votes
2 answers
95 views

Is sklearn using both a threshold and a bias term? [closed]

Reading this Can a neuron have both a bias and a threshold? has confused me, as it appears to be more common to use a threshold of 0 when using bias. But reading this https://stackoverflow.com/...
Leosa99 _'s user avatar
1 vote
1 answer
187 views

How can I interpret the value returned by score(X) method of sklearn.neighbors.KernelDensity?

For sklearn.neighbors.KernelDensity, its score(X) method according to the sklearn KDE documentation says: Compute the log-...
Arun's user avatar
  • 225
0 votes
1 answer
354 views

How to make a proper approximation of Sine function with Neural Networks?

TL;DR; How to build a neural network that properly approximates the sine function with different ranges? Context and Question: From this question I decided to use the Sergey's answer, however I used a ...
Hans's user avatar
  • 111
0 votes
0 answers
110 views

What is the best machine learning algorithm for clustering dots based on coordinates $(x,y)$ with consideration of weight of the points?

I'm looking for a machine learning algorithm for clustering points based on their coordinates. Furthermore, I want to take into consideration the weights of each point. Suppose there is a weight in ...
chung sze wong's user avatar
0 votes
1 answer
115 views

Do I need to tune the hyper-parameters or more data if SVR model performs poorly?

I am using non-linear data to SVR and have tried tuning the hyperparameters and still have a poor model performance. Do I need more data or format the data for more suitable results? I get similar ...
Taqi Ahmed's user avatar
2 votes
0 answers
30 views

How matrix factorization helps with recommendations when it converges to the initial user-items matrix?

We can say that matrix factorization of a matrix $R$, in general, is finding two matrices $P$ and $Q$ such that $R \approx P.Q^{T}$ with some constraints on $P$ and $Q$. Looking at some matrix ...
KindNewbie's user avatar
4 votes
0 answers
470 views

When computing the ROC-AUC score for multi-class classification problems, when should we use One-vs-Rest and One-vs-One?

The sklearn's documentation of the method roc_auc_score states that the parameter multi_class can take the value ...
Leockl's user avatar
  • 151
5 votes
2 answers
766 views

Why isn't my decision tree classifier able to solve the XOR problem properly?

I was trying to solve an XOR problem, and the dataset seems like the one in the image. I plotted the tree and got this result: As I understand, the tree should have depth 2 and four leaves. The ...
Pedro Paiva's user avatar
0 votes
1 answer
262 views

Train a model using a multi-column text-filled excel sheet

I have an excel sheet filled with my own personal appreciations of movies I've watched, and I want to use it to train an AI model so that it can predict if I'll like a specific movie or not, based on ...
Prototype's user avatar
2 votes
0 answers
74 views

Suitable deep learning algorithms for spatial / geometric data

I have a task of classifying spatial data from a geographic information system. More precisely, I need a way to filter out unnecessary line segments from the CAD system before loading into the GIS (...
Oleg Bizin's user avatar
1 vote
1 answer
129 views

Interpretation of feature selection based on the model

The description of feature selection based on a random forest uses trees without pruning. Do I need to use tree pruning? The thing is, if I don't cut the trees, the forest will retrain. Below in the ...
user287629's user avatar
1 vote
0 answers
65 views

How can I split the data into training and validation sets such that entries with a certain value are kept together?

I have the following kind of data frame. These are just example: A 1 Normal A 2 Normal A 3 Stress B 1 Normal B 2 Stress B 3 Stress C 1 Normal C 2 Normal C 3 Normal ...
user1631306's user avatar
5 votes
2 answers
3k views

Can ML be used to curve fit data based on dataset of example fits?

Say I have x,y data connected by a function with some additional parameters (a,b,c): $$ y = f(x ; a, b, c) $$ Now given a set of data points (x and y) I want to determine a,b,c. If I know the model ...
argentum2f's user avatar
2 votes
1 answer
82 views

Is it compulsary to normalize the dataset if doing so can negatively impact a Binary Logistic regression performance?

I am using raw data set with 4 feature variables (Total Cholesterol, Systolic Blood Pressure, Diastolic Blood Pressure, and Cigraeette count) to do a Binominal Classification (find stroke likelihood) ...
GYSHIDO's user avatar
  • 51
1 vote
0 answers
85 views

How can I use gradient boosting with multiple features?

I'm trying to use gradient boosting and I'm using sklearn's GradientBoostingClassifier class. My problem is that I'm having a data frame with 5 columns and I want ...
Kamran Hosseini's user avatar