id
stringlengths
7
11
source
stringclasses
1 value
category
stringclasses
11 values
title
stringlengths
15
214
text
stringlengths
70
30.5k
url
stringlengths
57
160
tags
stringlengths
3
113
created_at
int64
1.22B
1.79B
se_47910446
stackoverflow
MACHINE_LEARNING
Sklearn Gaussian Mixture lock parameters?
Sklearn Gaussian Mixture lock parameters? I'm trying to fit some gaussians, of which I already have a pretty good idea about the initial parameters (in this case, I'm generating the distributions, so I should always be able to fit these). However, I can't seem to figure out how to force the mean to be e.g. 0 for both ...
https://stackoverflow.com/questions/47910446/sklearn-gaussian-mixture-lock-parameters
python, scikit-learn
1,513,787,140
se_63935621
stackoverflow
MACHINE_LEARNING
Function for estimation of Gaussian Mixture Model with fixed means in python?
Function for estimation of Gaussian Mixture Model with fixed means in python? Is there a function for estimation of GMM model with fixed means? So far I have found only sklearn.mixture.GaussianMixture which however takes only initial means, but AFAIK can not fix the means. Is there any alternative?
https://stackoverflow.com/questions/63935621/function-for-estimation-of-gaussian-mixture-model-with-fixed-means-in-python
python, scikit-learn, gmm
1,600,336,667
se_42139319
stackoverflow
MACHINE_LEARNING
Lock steps (prevent refit) in scikit-learn pipeline
Lock steps (prevent refit) in scikit-learn pipeline Is there a convenient mechanism for locking steps in a scikit-learn pipeline to prevent them from refitting on pipeline.fit()? For example: import numpy as np from sklearn.feature_extraction.text import CountVectorizer from sklearn.svm import LinearSVC from sklearn....
https://stackoverflow.com/questions/42139319/lock-steps-prevent-refit-in-scikit-learn-pipeline
scikit-learn
1,486,650,577
se_64969066
stackoverflow
MACHINE_LEARNING
how to silence sklearn warning on _logistic regression
how to silence sklearn warning on _logistic regression Regression didn't work because data don't correlate. I understand I could increase the number of iterations. However, in this case I don't want to see the following warning: lib/python3.7/site-packages/sklearn/linear_model/_logistic.py:939: ConvergenceWarning: lbf...
https://stackoverflow.com/questions/64969066/how-to-silence-sklearn-warning-on-logistic-regression
scikit-learn, regression, warnings, logistic-regression
1,606,136,974
se_79541286
stackoverflow
MACHINE_LEARNING
Different Feature Selection Results Between Local (Ubuntu VM) and Databricks Using sklearn's SequentialFeatureSelector
Different Feature Selection Results Between Local (Ubuntu VM) and Databricks Using sklearn's SequentialFeatureSelector I am migrating from running my machine learning pipeline in VS Code with Ubuntu on a VM into Databricks. When I test the same dataset using the same code, I get different selected features from Se...
https://stackoverflow.com/questions/79541286/different-feature-selection-results-between-local-ubuntu-vm-and-databricks-usi
python, machine-learning, scikit-learn, databricks, feature-selection
1,743,160,974
se_76626629
stackoverflow
MACHINE_LEARNING
SKlearn classifier's predict_proba doesn't sum to 1
SKlearn classifier's predict_proba doesn't sum to 1 I have a classifier (in this case, it is the sklearn.MLPClassifier), with which I'm trying to perform classification into one of 18 classes. The class is thus multi-class, not multi-label. I'm trying to predict only a single class. I have my training data: X...
https://stackoverflow.com/questions/76626629/sklearn-classifiers-predict-proba-doesnt-sum-to-1
python, machine-learning, scikit-learn
1,688,629,888
se_66814510
stackoverflow
MACHINE_LEARNING
DecisiontreeClassifier, why is the sum of values wrong?
DecisiontreeClassifier, why is the sum of values wrong? I visualized my decisiontreeclassifier and I noticed, that the sum of samples are wrong or formulated differently the 'value' value does not fit with the value of the samples(Screenshot)? Do I misinterpret my Decisiontree? I thought if got 100 samples in my node ...
https://stackoverflow.com/questions/66814510/decisiontreeclassifier-why-is-the-sum-of-values-wrong
python, matplotlib, scikit-learn, decision-tree
1,616,752,156
se_52837387
stackoverflow
MACHINE_LEARNING
How to fix "E: Package 'libatlas-dev' has no installation candidate" While installing Scipy for Scikit learn?
How to fix "E: Package 'libatlas-dev' has no installation candidate" While installing Scipy for Scikit learn? how do i fix this problem i gave sudo apt-get install python-setuptools python-scipy libatlas-dev libatlas3-base to install scipy for installing scikit learn and got an error like this R...
https://stackoverflow.com/questions/52837387/how-to-fix-e-package-libatlas-dev-has-no-installation-candidate-while-insta
python, scikit-learn, scipy, ubuntu-18.04
1,539,698,728
se_59065058
stackoverflow
MACHINE_LEARNING
Yocto: create recipe for SciKit-learn
Yocto: create recipe for SciKit-learn I'm attempting to create a recipe for SciKit-Learn from pypi. But it seems that python3 setup.py build is unable to find NumPy, even though i know i have it on the build host (both with pip3 install numpy and bitbake python3-numpy-native). Right now i have the following in my rec...
https://stackoverflow.com/questions/59065058/yocto-create-recipe-for-scikit-learn
python-3.x, linux, numpy, scikit-learn, yocto
1,574,839,515
se_78672059
stackoverflow
MACHINE_LEARNING
Problems with selecting OptunaSearchCV pipeline parameters
Problems with selecting OptunaSearchCV pipeline parameters I have a code with which I iterate over the hyperparameters of both the model itself and the entire pipeline preprocessor = ColumnTransformer( [ ('OneHotEncoder', OneHotEncoder(drop='if_binary', sparse_output=False), binary_cols), ...
https://stackoverflow.com/questions/78672059/problems-with-selecting-optunasearchcv-pipeline-parameters
machine-learning, scikit-learn, gridsearchcv, hyperopt
1,719,400,466
se_56134072
stackoverflow
MACHINE_LEARNING
Random forest getting 100% score since feature selection
Random forest getting 100% score since feature selection I have been working on a dataset. I have followed this process to predict churn: Encoded and standardised data Run random forest Got a model score of 0.63 Analysed feature importances Ran model for reduced feature set Got a model score of 1.0 in the revised mod...
https://stackoverflow.com/questions/56134072/random-forest-getting-100-score-since-feature-selection
python, machine-learning, scikit-learn
1,557,848,201
se_77674168
stackoverflow
MACHINE_LEARNING
installation old version of scikitlearn
installation old version of scikitlearn how i can install old version of scikit-learn ? i need use boston house price data set and this data set didnt work on new version of scilitlearn beacuse this message: load_boston` has been removed from scikit-learn since version 1.2. The Boston housing prices dataset has an et...
https://stackoverflow.com/questions/77674168/installation-old-version-of-scikitlearn
python, scikit-learn
1,702,811,600
se_42562146
stackoverflow
MACHINE_LEARNING
Classification report with Nested Cross Validation in SKlearn (Average/Individual values)
Classification report with Nested Cross Validation in SKlearn (Average/Individual values) Is it possible to get classification report from cross_val_score through some workaround? I'm using nested cross-validation and I can get various scores here for a model, however, I would like to see the classification report of ...
https://stackoverflow.com/questions/42562146/classification-report-with-nested-cross-validation-in-sklearn-average-individua
python, machine-learning, scikit-learn, classification, cross-validation
1,488,476,022
se_47917287
stackoverflow
MACHINE_LEARNING
How to hand-engineer features of TfidfVectorizer in Scikit-learn?
How to hand-engineer features of TfidfVectorizer in Scikit-learn? I am trying to cluster documents by keywords. I'm using the following code to make a tdidf-matrix: from sklearn.feature_extraction.text import TfidfVectorizer tfidf_vectorizer = TfidfVectorizer(max_df=.8, max_features=1000, ...
https://stackoverflow.com/questions/47917287/how-to-hand-engineer-features-of-tfidfvectorizer-in-scikit-learn
python, scikit-learn, nlp
1,513,825,085
se_64115084
stackoverflow
MACHINE_LEARNING
Are predictions on scikit-learn models thread-safe?
Are predictions on scikit-learn models thread-safe? Given some classifier (SVC/Forest/NN/whatever) is it safe to call .predict on the same instance concurrently from different threads? From a distant point of view, my guess is they do not mutate any internal state. But I did not find anything in the docs about it. Her...
https://stackoverflow.com/questions/64115084/are-predictions-on-scikit-learn-models-thread-safe
python, scikit-learn, thread-safety, predict
1,601,365,581
se_53633838
stackoverflow
MACHINE_LEARNING
Resolving differences between Keras and scikit-learn for simple fully-connected neural network
Resolving differences between Keras and scikit-learn for simple fully-connected neural network I have built a fully-connected neural network in both scikit-learn (v 0.20.0) and Keras (v 2.2.4) with TensorFlow backend (v 1.12.0). There are 10 units in the single hidden layer. In both cases I choose the training and t...
https://stackoverflow.com/questions/53633838/resolving-differences-between-keras-and-scikit-learn-for-simple-fully-connected
python, tensorflow, scikit-learn, keras
1,544,017,705
se_61453581
stackoverflow
MACHINE_LEARNING
Can't import MinMaxScaler "from sklearn.preprocessing import MinMaxScaler"
Can't import MinMaxScaler "from sklearn.preprocessing import MinMaxScaler" I run into the following error when running my script. Could someone please let me know what the issue could be? I have installed Sklearn on my system, and using "pip list" I can see 'sklearn 0.0" is present. C:\Users\User\AppDat...
https://stackoverflow.com/questions/61453581/cant-import-minmaxscaler-from-sklearn-preprocessing-import-minmaxscaler
python, scikit-learn
1,587,972,098
se_79657196
stackoverflow
MACHINE_LEARNING
Why does sklearn GaussianMixtures spawn a cmd window when run from IDLE?
Why does sklearn GaussianMixtures spawn a cmd window when run from IDLE? When I run this code using IDLE in windows, it spawns a temporary cmd window that disappears shortly thereafter. import numpy as np import matplotlib.pyplot as plt from sklearn.mixture import GaussianMixture # Step 1: Generate random data np.ran...
https://stackoverflow.com/questions/79657196/why-does-sklearn-gaussianmixtures-spawn-a-cmd-window-when-run-from-idle
scikit-learn, python-idle, python-3.12, gaussian-mixture-model
1,749,316,960
se_36057245
stackoverflow
MACHINE_LEARNING
Relationship of two time series using Scikit or Pandas
Relationship of two time series using Scikit or Pandas Say I have two hypothetical time series data one for rainfall and the other is ocean surface temperature. Rainfall Time Series: 2001-12-31 25 mm 2002-12-31 50 mm 2003-12-31 75 mm 2004-12-31 50 mm 2005-12-31 25 mm 2006-12-31 10 mm 2007-12-31 6 ...
https://stackoverflow.com/questions/36057245/relationship-of-two-time-series-using-scikit-or-pandas
python, pandas, scikit-learn, time-series
1,458,209,040
se_23030284
stackoverflow
MACHINE_LEARNING
Content based recommender system with sklearn or numpy
Content based recommender system with sklearn or numpy I am trying to build a content-based recommender system in python/pandas/numpy/sklearn. Here are the matrix involved and their size: X: n_customers * n_features (contains the features of each customer) Y: n_customers *n_products (contains the scores given by ea...
https://stackoverflow.com/questions/23030284/content-based-recommender-system-with-sklearn-or-numpy
python, numpy, machine-learning, scikit-learn, recommendation-engine
1,397,305,162
se_62730016
stackoverflow
MACHINE_LEARNING
Python: 'StandardScaler' object has no attribute '_validate_data'
Python: 'StandardScaler' object has no attribute '_validate_data' I recently updated my sklearn. However, since the upgrade I'm getting the error AttributeError: 'StandardScaler' object has no attribute '_validate_data'. The following is a snippet of the code: Xs = pd.DataFrame([[10,20], [20,30], [30,4...
https://stackoverflow.com/questions/62730016/python-standardscaler-object-has-no-attribute-validate-data
python, pandas, scikit-learn, standardization
1,593,871,011
se_37685412
stackoverflow
MACHINE_LEARNING
Avoid scaling binary columns in sci-kit learn StandsardScaler
Avoid scaling binary columns in sci-kit learn StandsardScaler I'm building a linear regression model in sci-kit learn, and am scaling the inputs as a preprocessing step in a sci-kit learn Pipeline. Is there any way I can avoid scaling binary columns? What's happening is that these columns are being scaled with every o...
https://stackoverflow.com/questions/37685412/avoid-scaling-binary-columns-in-sci-kit-learn-standsardscaler
python, scikit-learn, multi-dimensional-scaling
1,465,319,698
se_69083477
stackoverflow
MACHINE_LEARNING
Using Ordinal Encoding with Pipeline when there is new data in test set
Using Ordinal Encoding with Pipeline when there is new data in test set Trying to use pipeline of One-Hot/Ordinal encoding with different models using cross_val_score. When there is unseen data in test set I handle it like this for OHE: ohe = make_column_transformer((OneHotEncoder(handle_unknown='ignore'), cate_cols),...
https://stackoverflow.com/questions/69083477/using-ordinal-encoding-with-pipeline-when-there-is-new-data-in-test-set
python, scikit-learn
1,630,997,020
se_70965317
stackoverflow
MACHINE_LEARNING
How to fit column wise ordinal encoding
How to fit column wise ordinal encoding I have a dataframe like as shown below tdf = pd.DataFrame({'grade': np.random.choice(list('AAAD'),size=(5)), 'dash': np.random.choice(list('PPPS'),size=(5)), 'dumeel': np.random.choice(list('QWRR'),size=(5)), 'dumma': np.r...
https://stackoverflow.com/questions/70965317/how-to-fit-column-wise-ordinal-encoding
python, pandas, machine-learning, scikit-learn, deep-learning
1,643,856,067
se_65230811
stackoverflow
MACHINE_LEARNING
Correct compute of equal error rate value
Correct compute of equal error rate value My work is to classifiy users' legitimate data from importers' data. I used binary SVM classifier to output probabilites of the two classes. Then used the Roc curve from sklearn to return TPR and FPR vectors over different thresholds as follows: classifier = SVC(kernel='rbf', ...
https://stackoverflow.com/questions/65230811/correct-compute-of-equal-error-rate-value
python, scikit-learn, svm
1,607,588,367
se_36107820
stackoverflow
MACHINE_LEARNING
How to tune parameters in Random Forest, using Scikit Learn?
How to tune parameters in Random Forest, using Scikit Learn? class sklearn.ensemble.RandomForestClassifier(n_estimators=10, criterion='gini', max_depth=None, min_samples_split=2, ...
https://stackoverflow.com/questions/36107820/how-to-tune-parameters-in-random-forest-using-scikit-learn
python, parameters, machine-learning, scikit-learn, random-forest
1,458,425,448
se_38015181
stackoverflow
MACHINE_LEARNING
Accuracy Score ValueError: Can't Handle mix of binary and continuous target
Accuracy Score ValueError: Can't Handle mix of binary and continuous target I'm using linear_model.LinearRegression from scikit-learn as a predictive model. It works and it's perfect. I have a problem to evaluate the predicted results using the accuracy_score metric. This is my true Data : array([1, 1, 0, 0, 0, 0,...
https://stackoverflow.com/questions/38015181/accuracy-score-valueerror-cant-handle-mix-of-binary-and-continuous-target
python, machine-learning, scikit-learn, linear-regression, prediction
1,466,776,637
se_29095769
stackoverflow
MACHINE_LEARNING
Sklearn-GMM on large datasets
Sklearn-GMM on large datasets I have a large data-set (I can't fit entire data on memory). I want to fit a GMM on this data set. Can I use GMM.fit() (sklearn.mixture.GMM) repeatedly on mini batch of data ??
https://stackoverflow.com/questions/29095769/sklearn-gmm-on-large-datasets
python, scikit-learn, bigdata, mixture-model
1,426,585,362
se_41567895
stackoverflow
MACHINE_LEARNING
Will scikit-learn utilize GPU?
Will scikit-learn utilize GPU? Reading implementation of scikit-learn in TensorFlow: http://learningtensorflow.com/lesson6/ and scikit-learn: http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html I'm struggling to decide which implementation to use. scikit-learn is installed as part of the tenso...
https://stackoverflow.com/questions/41567895/will-scikit-learn-utilize-gpu
python, tensorflow, scikit-learn, k-means, neuraxle
1,484,048,243
se_54945196
stackoverflow
MACHINE_LEARNING
sklearn stratified k-fold CV with linear model like ElasticNetCV
sklearn stratified k-fold CV with linear model like ElasticNetCV using cross validation (CV) with sklearn is quite easy and straight-forward. But the default implementation when setting cv=5 in a linear CV model, like ElasticNetCV or LassoCV is a KFold CV. For various reasons I'd like to use a StratifiedKFold. From th...
https://stackoverflow.com/questions/54945196/sklearn-stratified-k-fold-cv-with-linear-model-like-elasticnetcv
python, scikit-learn, regression, cross-validation
1,551,445,194
se_56496708
stackoverflow
MACHINE_LEARNING
F1 Score: ValueError: Classification metrics can't handle a mix of multiclass and multilabel-indicator targets
F1 Score: ValueError: Classification metrics can't handle a mix of multiclass and multilabel-indicator targets I have multi-class labeled text classification problem with 2000 different labels and I do classification using LSTM. Label Encoder of target variable LSTM layer with Embedd Layer Error metric is F2 scor...
https://stackoverflow.com/questions/56496708/f1-score-valueerror-classification-metrics-cant-handle-a-mix-of-multiclass-an
python, machine-learning, scikit-learn, data-science, lstm
1,559,919,337
se_79628711
stackoverflow
MACHINE_LEARNING
Grid search scikeras error : 'super' object has no attribute '__sklearn_tags__'
Grid search scikeras error : 'super' object has no attribute '__sklearn_tags__' I am trying to run a gridsearch in my pycharm jupyter notebook. Getting 'super' object has no attribute '__sklearn_tags__' error. This question was asked for RandomizedSearch previously, but none of the answers seem to wo...
https://stackoverflow.com/questions/79628711/grid-search-scikeras-error-super-object-has-no-attribute-sklearn-tags
python, tensorflow, keras, scikit-learn, pycharm
1,747,656,504
se_48413264
stackoverflow
MACHINE_LEARNING
M nearest points to centroid in K-Means clustering
M nearest points to centroid in K-Means clustering I have implemented a function to find the nearest data point to each centroid calculated after running the K-Means clustering algorithm. I wanted to know if there's a sklearn function that allows me to find the M nearest points to each of the centroids.
https://stackoverflow.com/questions/48413264/m-nearest-points-to-centroid-in-k-means-clustering
python, scikit-learn, cluster-analysis, k-means, centroid
1,516,755,415
se_75044832
stackoverflow
MACHINE_LEARNING
How do the splits in a decision tree classifier work?
How do the splits in a decision tree classifier work? I would like to know how the splits in the decision tree look like. More specifically, I am wondering if they can be "relative". For example can the criterion be something like: if x > y .. or does it have to be some absolute value, as in: if x > 0.5 .. I don't ...
https://stackoverflow.com/questions/75044832/how-do-the-splits-in-a-decision-tree-classifier-work
scikit-learn, random-forest, decision-tree
1,673,139,358
se_29611842
stackoverflow
MACHINE_LEARNING
scikit-learn kernel PCA explained variance
scikit-learn kernel PCA explained variance I have been using the normal PCA from scikit-learn and get the variance ratios for each principal component without any issues. pca = sklearn.decomposition.PCA(n_components=3) pca_transform = pca.fit_transform(feature_vec) var_values = pca.explained_variance_ratio_ I want ...
https://stackoverflow.com/questions/29611842/scikit-learn-kernel-pca-explained-variance
python, scikit-learn
1,428,947,656
se_46015426
stackoverflow
MACHINE_LEARNING
How can I parallelize fitting a gradient boosting model with sklearn?
How can I parallelize fitting a gradient boosting model with sklearn? Relatively new to model building with sklearn. I know cross validation can be parallelized via the n_jobs parameter, but if I'm not using CV, how can I utilize my available cores to speed up model fitting?
https://stackoverflow.com/questions/46015426/how-can-i-parallelize-fitting-a-gradient-boosting-model-with-sklearn
python, machine-learning, scikit-learn
1,504,366,711
se_47521872
stackoverflow
MACHINE_LEARNING
Accessing Lasso Regression coefficients after fitting
Accessing Lasso Regression coefficients after fitting I'm trying to Lasso Regression after having optimal value of Lambda and now the problem is , I want to get the coefficients (weight vector) since I want to compare them with weights of Ridge regression. lasso = Lasso(alpha=optimal_lmbda, fit_intercept=True, random...
https://stackoverflow.com/questions/47521872/accessing-lasso-regression-coefficients-after-fitting
python, machine-learning, scikit-learn, regression, linear-regression
1,511,827,518
se_79290968
stackoverflow
MACHINE_LEARNING
'super' object has no attribute '__sklearn_tags__'
'super' object has no attribute '__sklearn_tags__' I am encountering an AttributeError while fitting an XGBRegressor using RandomizedSearchCV from Scikit-learn. The error message states: 'super' object has no attribute '__sklearn_tags__'. This occurs when I invoke the fit method on the RandomizedSearc...
https://stackoverflow.com/questions/79290968/super-object-has-no-attribute-sklearn-tags
python, machine-learning, scikit-learn, xgboost
1,734,522,352
se_76613438
stackoverflow
MACHINE_LEARNING
What is responsible for this TypeError: DataUndersampler.transform() missing 1 required positional argument: 'y'?
What is responsible for this TypeError: DataUndersampler.transform() missing 1 required positional argument: 'y'? This is a custom support vectorbased data undersampler answer from my previous question. The main idea is to undersample the majority class in an informed way, by fitting an SVC to the data, find t...
https://stackoverflow.com/questions/76613438/what-is-responsible-for-this-typeerror-dataundersampler-transform-missing-1-r
python, machine-learning, scikit-learn, classification
1,688,479,384
se_49538377
stackoverflow
MACHINE_LEARNING
Change in random state value changes the model accuracy
Change in random state value changes the model accuracy While testing my linear regression model, I find that changing the random_state parameter in train_test_split changes the model accuracy. To elaborate, my train test split is as follows: boston_data = load_boston() X = pd.DataFrame(boston_data.data, columns=bos...
https://stackoverflow.com/questions/49538377/change-in-random-state-value-changes-the-model-accuracy
python, scikit-learn, cross-validation, train-test-split
1,522,250,558
se_40025406
stackoverflow
MACHINE_LEARNING
Inherit from scikit-learn's LassoCV model
Inherit from scikit-learn's LassoCV model I tried to extend scikit-learn's RidgeCV model using inheritance: from sklearn.linear_model import RidgeCV, LassoCV class Extended(RidgeCV): def __init__(self, *args, **kwargs): super(Extended, self).__init__(*args, **kwargs) def example(self): p...
https://stackoverflow.com/questions/40025406/inherit-from-scikit-learns-lassocv-model
python, scikit-learn
1,476,373,212
se_57835219
stackoverflow
MACHINE_LEARNING
Different answers with imputation of missing values
Different answers with imputation of missing values I have made a classifier using Logistic Regression and for testing it I used the breast cancer dataset available at: https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+%28Original%29 This dataset contains missing values so I have changed those values wit...
https://stackoverflow.com/questions/57835219/different-answers-with-imputation-of-missing-values
python, pandas, numpy, scikit-learn
1,567,870,980
se_59254662
stackoverflow
MACHINE_LEARNING
sklearn ColumnTransformer with MultilabelBinarizer
sklearn ColumnTransformer with MultilabelBinarizer I wonder if it is possible to use a MultilabelBinarizer within a ColumnTransformer. I have a toy pandas dataframe like: df = pd.DataFrame({"id":[1,2,3], "text": ["some text", "some other text", "yet another text"], "label": [["white", "cat"], ["black", "cat"], ["b...
https://stackoverflow.com/questions/59254662/sklearn-columntransformer-with-multilabelbinarizer
python, python-3.x, scikit-learn, pipeline
1,575,916,150
se_52933862
stackoverflow
MACHINE_LEARNING
Sklearn or Pandas, impute missing values with simple linear regression
Sklearn or Pandas, impute missing values with simple linear regression I have time series data, and I want to impute the missing data. I cant use mean of the column because I think it's not good for time series data. So I want simple linear regression to impute it Day, Price 1, NaN 2, NaN 3, 1800 4, 1900 5, NaN ...
https://stackoverflow.com/questions/52933862/sklearn-or-pandas-impute-missing-values-with-simple-linear-regression
python, pandas, scikit-learn, data-mining
1,540,225,790
se_79601928
stackoverflow
MACHINE_LEARNING
do i need to scale the rf model while creating voting ensemble model?
do i need to scale the rf model while creating voting ensemble model? I'm building a classification model for sleep disorders using Voting Ensemble and I have three base models: Logistic Regression, Random Forest and SVM. Now I want to combine these models using a Voting Ensemble with soft voting.I don't really have a...
https://stackoverflow.com/questions/79601928/do-i-need-to-scale-the-rf-model-while-creating-voting-ensemble-model
python, machine-learning, scikit-learn, random-forest, ensemble-learning
1,746,105,731
se_79603555
stackoverflow
MACHINE_LEARNING
How to set a fixed random state in RandomizedSearchCV?
How to set a fixed random state in RandomizedSearchCV? I'm using RandomizedSearchCV with RandomForestClassifier in scikit-learn. I want to make sure my results are reproducible across runs. Where should I set the random_state—in the classifier, in RandomizedSearchCV, or both? Example code: from sklearn.ensemble import...
https://stackoverflow.com/questions/79603555/how-to-set-a-fixed-random-state-in-randomizedsearchcv
python, scikit-learn, data-science
1,746,195,585
se_79602705
stackoverflow
MACHINE_LEARNING
Why is DecisionTree using same feature and same condition twice
Why is DecisionTree using same feature and same condition twice When trying to fit scikit-learn DecisionTreeClassifier on my data, I am observing some weird behavior. x[54] (a boolan feature) is used to break the 19 samples into 2 and 17 on top left node. Then again, the same feature with exact same condition appears ...
https://stackoverflow.com/questions/79602705/why-is-decisiontree-using-same-feature-and-same-condition-twice
python, machine-learning, scikit-learn, classification, decision-tree
1,746,148,450
se_75472472
stackoverflow
MACHINE_LEARNING
Feature Importances for categorical features after one hot encoding?
Feature Importances for categorical features after one hot encoding? We need to encode a categorical feature with multiple categories, the resulting one-hot encoded feature will have importance scores separately for each category. If we want to combine these importances into a single feature importance for the origina...
https://stackoverflow.com/questions/75472472/feature-importances-for-categorical-features-after-one-hot-encoding
machine-learning, scikit-learn, feature-selection
1,676,551,445
se_55325114
stackoverflow
MACHINE_LEARNING
How to express Root Mean Squared Error as a percentage?
How to express Root Mean Squared Error as a percentage? I want to compare the result of my prediction with that of another person's prediction. In the article, the author says 'The relative percentage of root mean square (RMS%) was used to evaluate the performance'. This is what I want to compare my prediction to. C...
https://stackoverflow.com/questions/55325114/how-to-express-root-mean-squared-error-as-a-percentage
python, machine-learning, scikit-learn, mean-square-error
1,553,439,602
se_69675761
stackoverflow
MACHINE_LEARNING
Scikit-learn: NameError: name 'load_iris' is not defined
Scikit-learn: NameError: name 'load_iris' is not defined I got the error message of scikit-learn: iris database = load_iris () and after I get the error :NameError: name 'load_iris' is not defined What could be the problem? Help me please! I use : Phyton 3.9.5 Anaconda 4.10.1 Scikit-learn 2.2.0
https://stackoverflow.com/questions/69675761/scikit-learn-nameerror-name-load-iris-is-not-defined
python, scikit-learn
1,634,900,640
se_79586660
stackoverflow
MACHINE_LEARNING
Linear regression prediction does not display properly
Linear regression prediction does not display properly I want to make 2 different linear regressions for 2 diferent plots, but on the same figure. I have a problem with the y1_pred because it does not go for all the y axis where are scatters. model1 = LinearRegression().fit(x, y) intercept1 = model1.intercept_ slope1 ...
https://stackoverflow.com/questions/79586660/linear-regression-prediction-does-not-display-properly
python, matplotlib, scikit-learn
1,745,330,758
se_38646040
stackoverflow
MACHINE_LEARNING
AttributeError: LinearRegression object has no attribute 'coef_'
AttributeError: LinearRegression object has no attribute 'coef_' I've been attempting to fit this data by a Linear Regression, following a tutorial on bigdataexaminer. Everything was working fine up until this point. I imported LinearRegression from sklearn, and printed the number of coefficients just fine. Th...
https://stackoverflow.com/questions/38646040/attributeerror-linearregression-object-has-no-attribute-coef
python, python-3.x, scikit-learn, linear-regression, attributeerror
1,469,737,342
se_59640880
stackoverflow
MACHINE_LEARNING
How to determine the positive class in roc_auc_score?
How to determine the positive class in roc_auc_score? I want to use roc_auc_score to evaluate the performance of the classifier, but I'm not sure what is the right parameters to give it. This is a description of this function in the documentation: documentation. As you can see, it needs y_score, which is the probabi...
https://stackoverflow.com/questions/59640880/how-to-determine-the-positive-class-in-roc-auc-score
machine-learning, scikit-learn, svm, auc
1,578,466,881
se_69476352
stackoverflow
MACHINE_LEARNING
sklearn MinMaxScaler() with groupby pandas
sklearn MinMaxScaler() with groupby pandas I have two features rank and ratings for different product IDs under different categories scraped from an ecommerce website on different dates. sample dataframe available here: import pandas as pd import numpy as np import warnings; warnings.simplefilter('ignore') from sklear...
https://stackoverflow.com/questions/69476352/sklearn-minmaxscaler-with-groupby-pandas
python, pandas, scikit-learn
1,633,587,996
se_52648383
stackoverflow
MACHINE_LEARNING
How to get coefficients and feature importances from MultiOutputRegressor?
How to get coefficients and feature importances from MultiOutputRegressor? I am trying to perform a MultiOutput Regression using ElasticNet and Random Forests as follows: from sklearn.ensemble import RandomForestRegressor from sklearn.multioutput import MultiOutputRegressor from sklearn.linear_model import ElasticNet...
https://stackoverflow.com/questions/52648383/how-to-get-coefficients-and-feature-importances-from-multioutputregressor
python, machine-learning, scikit-learn
1,538,660,801
se_79586934
stackoverflow
MACHINE_LEARNING
Python Sklearn.Model_Selection giving error numpy.dtype size changed
Python Sklearn.Model_Selection giving error numpy.dtype size changed I have a train test split code from sklearn.model_selection import train_test_split train_df, test_df = train_test_split(new_cleaned_df, test_size=0.05, random_state=42, shuffle=True) train_df.reset_index(drop=True, inplace=True) test_df.reset_index...
https://stackoverflow.com/questions/79586934/python-sklearn-model-selection-giving-error-numpy-dtype-size-changed
python, numpy, scikit-learn
1,745,337,308
se_79227212
stackoverflow
MACHINE_LEARNING
Polynomial regression with 2D array
Polynomial regression with 2D array I have two 2D datasets Xand Y, which respectively represent experimental and theoretical data. In the two cases, each row corresponds to a sample (one physical configuration), and each column corresponds to a measurement done by a sensor at one particular location (feature). These t...
https://stackoverflow.com/questions/79227212/polynomial-regression-with-2d-array
python, scikit-learn, regression, polynomials
1,732,633,020
se_79418004
stackoverflow
MACHINE_LEARNING
How to force all terms in 1-D Gaussian mixture model to have the same mean?
How to force all terms in 1-D Gaussian mixture model to have the same mean? I have a one-dimensional set of data points, of which I want to parameterise the probability density. I have reasons to believe that a Gaussian mixture model would be a good way to accomplish this, so I'm trying to use scikit-learn's GaussianM...
https://stackoverflow.com/questions/79418004/how-to-force-all-terms-in-1-d-gaussian-mixture-model-to-have-the-same-mean
python, scikit-learn
1,738,847,045
se_79515542
stackoverflow
MACHINE_LEARNING
Length of features is not equal to the length of SHAP Values
Length of features is not equal to the length of SHAP Values Im running a random forest model and to get some feature importance and Im trying to run a SHAP analysis. The problem is that every time I try to plot the shap values, I keep getting this error: DimensionError: Length of features is not equal to the length o...
https://stackoverflow.com/questions/79515542/length-of-features-is-not-equal-to-the-length-of-shap-values
python, machine-learning, scikit-learn, random-forest, shap
1,742,239,005
se_34143829
stackoverflow
MACHINE_LEARNING
Sklearn How to Save a Model Created From a Pipeline and GridSearchCV Using Joblib or Pickle?
Sklearn How to Save a Model Created From a Pipeline and GridSearchCV Using Joblib or Pickle? After identifying the best parameters using a pipeline and GridSearchCV, how do I pickle/joblib this process to re-use later? I see how to do this when it's a single classifier... import joblib joblib.dump(clf, 'filename.pkl')...
https://stackoverflow.com/questions/34143829/sklearn-how-to-save-a-model-created-from-a-pipeline-and-gridsearchcv-using-jobli
python, scikit-learn, file-io, pickle, gridsearchcv
1,449,524,783
se_79583640
stackoverflow
MACHINE_LEARNING
Keras SKLearnClassifier wrapper can't fit MNIST data
Keras SKLearnClassifier wrapper can't fit MNIST data I'm trying to use the SKLearnClassifier Keras wrapper to do some grid searching and cross validation using the sklearn library but I'm unable to get the model to work properly. def build_model(X, y, n_neurons: List[str], learning_rate: float): model = keras....
https://stackoverflow.com/questions/79583640/keras-sklearnclassifier-wrapper-cant-fit-mnist-data
python, keras, scikit-learn, mnist
1,745,173,911
se_70719940
stackoverflow
MACHINE_LEARNING
How to get bag of words and term frequency in text format using Sklearn?
How to get bag of words and term frequency in text format using Sklearn? I would like to print out the list of words (i.e., bag of words) for each document in a coprus and their respective term frequency (in text format), using Sklearn's CountVectorizer. How could I achieve that? Here is my code: from sklearn.feature_...
https://stackoverflow.com/questions/70719940/how-to-get-bag-of-words-and-term-frequency-in-text-format-using-sklearn
python, scikit-learn, nlp, corpus, countvectorizer
1,642,235,584
se_79407078
stackoverflow
MACHINE_LEARNING
GaussianProcessRegressor object in scikit-learn: select fixed hyperparameters, cannot reproduce optimised kernel
GaussianProcessRegressor object in scikit-learn: select fixed hyperparameters, cannot reproduce optimised kernel I am trying to understand the GaussianProcessRegressor object in scikit-learn alas, unsuccessfully. Considering the example in the documentation Example with noisy targets, which I copy below for convenienc...
https://stackoverflow.com/questions/79407078/gaussianprocessregressor-object-in-scikit-learn-select-fixed-hyperparameters-c
machine-learning, scikit-learn, gaussian-process
1,738,520,249
se_30843011
stackoverflow
MACHINE_LEARNING
Save and reuse TfidfVectorizer in scikit learn
Save and reuse TfidfVectorizer in scikit learn I am using TfidfVectorizer in scikit learn to create a matrix from text data. Now I need to save this object to reuse it later. I tried to use pickle, but it gave the following error. loc=open('vectorizer.obj','w') pickle.dump(self.vectorizer,loc) *** TypeError: can't pic...
https://stackoverflow.com/questions/30843011/save-and-reuse-tfidfvectorizer-in-scikit-learn
python, scikit-learn, file-io, nlp, pickle
1,434,364,538
se_79576028
stackoverflow
MACHINE_LEARNING
Confirm understanding of decision_function in Isolation Forest
Confirm understanding of decision_function in Isolation Forest I am looking to better understand sklearn IsolationForest decision_function. My understanding from this previous stack overflow post, What is the difference between decision function and score_samples in isolation_forest in SKLearn, if the metric is close...
https://stackoverflow.com/questions/79576028/confirm-understanding-of-decision-function-in-isolation-forest
python, machine-learning, scikit-learn, anomaly-detection, isolation-forest
1,744,751,255
se_79504108
stackoverflow
MACHINE_LEARNING
How is each tree within DecisionTreeClassifier calculating probability of a class?
How is each tree within DecisionTreeClassifier calculating probability of a class? According to the sklearn docs, if you apply predict_proba to DecisionTreeClassifier: The predicted class probability is the fraction of samples of the same class in a leaf. Let's say that the rows where class = 1 in my training datase...
https://stackoverflow.com/questions/79504108/how-is-each-tree-within-decisiontreeclassifier-calculating-probability-of-a-clas
scikit-learn, classification, decision-tree
1,741,794,197
se_79577490
stackoverflow
MACHINE_LEARNING
How to fit scaler for different subsets of rows depending on group variable and include it in a Pipeline?
How to fit scaler for different subsets of rows depending on group variable and include it in a Pipeline? I have a data set like the following and want to scale the data using any of the scalers in sklearn.preprocessing. Is there an easy way to fit this scaler not over the whole data set, but per group? My current sol...
https://stackoverflow.com/questions/79577490/how-to-fit-scaler-for-different-subsets-of-rows-depending-on-group-variable-and
python, pandas, scikit-learn, data-transform, scikit-learn-pipeline
1,744,815,535
se_79570774
stackoverflow
MACHINE_LEARNING
reg.predict is telling me I am not providing an array
reg.predict is telling me I am not providing an array It seems I have an issue with an array that I thought I coded correctly. When I ask for reg.score or reg.coef_ the code works great, but when I try to predict it throws an error that is saying it is not 2 dimensional or an array. Can somebody tell me what I did wro...
https://stackoverflow.com/questions/79570774/reg-predict-is-telling-me-i-am-not-providing-an-array
python, scikit-learn
1,744,480,371
se_74281988
stackoverflow
MACHINE_LEARNING
How to input a matrix and receive value (or array of values) using machine learning in Python?
How to input a matrix and receive value (or array of values) using machine learning in Python? I have a bunch of binary 8x15 matrixes and I want to determine which index (row and column) of the matrix breaks the pattern. Say I have the following matrix (simplified to 5x5 for ease, because the problem remains the same)...
https://stackoverflow.com/questions/74281988/how-to-input-a-matrix-and-receive-value-or-array-of-values-using-machine-learn
python, machine-learning, matrix, scikit-learn
1,667,338,138
se_79575941
stackoverflow
MACHINE_LEARNING
Why does RandomForestClassifier in scikit-learn predict even on all-NaN input?
Why does RandomForestClassifier in scikit-learn predict even on all-NaN input? I am training a random forest classifier in python sklearn, see code below- from sklearn.ensemble import RandomForestClassifier rf = RandomForestClassifier(random_state=42) rf.fit(X = df.drop("AP", axis =1), y = df["AP"].astype(int)) When...
https://stackoverflow.com/questions/79575941/why-does-randomforestclassifier-in-scikit-learn-predict-even-on-all-nan-input
python, machine-learning, scikit-learn, random-forest, missing-data
1,744,746,839
se_61708970
stackoverflow
MACHINE_LEARNING
What are Mutual_info_regression and Mutual_info_classif used for in scikit-learn?
What are Mutual_info_regression and Mutual_info_classif used for in scikit-learn? I'm learning about feature selection of big datasets. I came across methods called Mutual_info_regression() and Mutual_info_classif(). They return a value for all the features. What does that value represent?
https://stackoverflow.com/questions/61708970/what-are-mutual-info-regression-and-mutual-info-classif-used-for-in-scikit-learn
python, machine-learning, scikit-learn
1,589,098,165
se_53470097
stackoverflow
MACHINE_LEARNING
how to apply mutual information on categorical features
how to apply mutual information on categorical features I am using Scikit-learn to train a classification model. I have both discrete and continuous features in my training data. I want to do feature selection using mutual information. The features 1,2 and 3 are discrete. to this end, I try the code below : mut...
https://stackoverflow.com/questions/53470097/how-to-apply-mutual-information-on-categorical-features
python, scikit-learn
1,543,167,280
se_22562540
stackoverflow
MACHINE_LEARNING
Pandas dataset into an array for modelling in Scikit-Learn
Pandas dataset into an array for modelling in Scikit-Learn Can we run scikit-learn models on Pandas DataFrames or do we need to convert DataFrames into NumPy arrays?
https://stackoverflow.com/questions/22562540/pandas-dataset-into-an-array-for-modelling-in-scikit-learn
python, pandas, scikit-learn
1,395,412,291
se_55108902
stackoverflow
MACHINE_LEARNING
module 'numpy' has no attribute 'dtype'
module &#39;numpy&#39; has no attribute &#39;dtype&#39; When importing sklearn datasets eg. from sklearn.datasets import fetch_mldata from sklearn.datasets import fetch_openml I get the error Traceback (most recent call last): File "numbers.py", line 1, in <module> from sklearn.datasets import fetch_openml ...
https://stackoverflow.com/questions/55108902/module-numpy-has-no-attribute-dtype
python, numpy, scikit-learn, python-3.5, python-import
1,552,331,940
se_23939750
stackoverflow
MACHINE_LEARNING
Understanding max_features parameter in RandomForestRegressor
Understanding max_features parameter in RandomForestRegressor While constructing each tree in the random forest using bootstrapped samples, for each terminal node, we select m variables at random from p variables to find the best split (p is the total number of features in your data). My questions (for RandomForestReg...
https://stackoverflow.com/questions/23939750/understanding-max-features-parameter-in-randomforestregressor
machine-learning, scikit-learn, random-forest, feature-selection
1,401,385,976
se_79454515
stackoverflow
MACHINE_LEARNING
Specify minimum surface constraint for sklearn GPR prediction
Specify minimum surface constraint for sklearn GPR prediction I'm trying to use sklearn.GaussianProccessRegression to fit data, then estimate new points using the regression. The predictions need to be positive (preferably above a specified minimum). I'd like to use that minimum as a constraint in the solver. The back...
https://stackoverflow.com/questions/79454515/specify-minimum-surface-constraint-for-sklearn-gpr-prediction
optimization, scikit-learn, gaussian-process
1,740,054,540
se_42302245
stackoverflow
MACHINE_LEARNING
Stratified GroupShuffleSplit in Scikit-learn
Stratified GroupShuffleSplit in Scikit-learn I would like to ask if it is possible to do "Stratified GroupShuffleSplit" in scikit-learn which is in other words a combination of GroupShuffleSplit and StratifiedShuffleSplit Here is a sample of the code I am using: cv=GroupShuffleSplit(n_splits=n_splits,test_size=test_...
https://stackoverflow.com/questions/42302245/stratified-groupshufflesplit-in-scikit-learn
python, scikit-learn, dataset, shuffle, cross-validation
1,487,347,190
se_30384995
stackoverflow
MACHINE_LEARNING
RandomForestClassfier.fit(): ValueError: could not convert string to float
RandomForestClassfier.fit(): ValueError: could not convert string to float Given is a simple CSV file: A,B,C Hello,Hi,0 Hola,Bueno,1 Obviously the real dataset is far more complex than this, but this one reproduces the error. I'm attempting to build a random forest classifier for it, like so: cols = ['A','B','C'] ...
https://stackoverflow.com/questions/30384995/randomforestclassfier-fit-valueerror-could-not-convert-string-to-float
python, scikit-learn, random-forest
1,432,245,075
se_65676129
stackoverflow
MACHINE_LEARNING
Yocto recipe for scikit-learn
Yocto recipe for scikit-learn I am trying to create a yocto recipe for scikit-learn package. It depends on scipy pacakge. I was able to successfully build the scipy package using : https://github.com/gpanders/meta-scipy. When I run bitbake python3-scikit-learn, i am getting the below error: ModuleNotFoundError: No mod...
https://stackoverflow.com/questions/65676129/yocto-recipe-for-scikit-learn
python, scikit-learn, scipy, yocto, bitbake
1,610,408,860
se_28888336
stackoverflow
MACHINE_LEARNING
error with the loading files in scikit
error with the loading files in scikit I am new to scikit-learn and tried to follow the tutorial on the site : http://scikit-learn.org/dev/tutorial/text_analytics/working_with_text_data.html I downloaded the dataset, and used the load_files to load it but I keep getting error about the encoding. Below is how it is lo...
https://stackoverflow.com/questions/28888336/error-with-the-loading-files-in-scikit
scikit-learn
1,425,591,788
se_78991033
stackoverflow
MACHINE_LEARNING
How to solve ERROR: daal4py 2021.5.0 requires daal==2021.4.0, which is not installed?
How to solve ERROR: daal4py 2021.5.0 requires daal==2021.4.0, which is not installed? I try to install sklearn package and getting the warning below: > File D:\ANACONDA\envs\TenserFlow\lib\site-packages\scipy\sparse\linalg\_svdp.py:24 from ._propack import _spropack # type: ignore[attr-defined] ImportE...
https://stackoverflow.com/questions/78991033/how-to-solve-error-daal4py-2021-5-0-requires-daal-2021-4-0-which-is-not-insta
python, scikit-learn
1,726,504,727
se_79371534
stackoverflow
MACHINE_LEARNING
Have only 2 classes but why am I getting ValueError: Target is multiclass but average = &#39;binary&#39;. Please choose another average setting
Have only 2 classes but why am I getting ValueError: Target is multiclass but average = &#39;binary&#39;. Please choose another average setting I am trying build an employee churn prediction model using GridSearchCV on OneClassSVM. My code is as below: from sklearn.svm import OneClassSVM from sklearn.model_selection i...
https://stackoverflow.com/questions/79371534/have-only-2-classes-but-why-am-i-getting-valueerror-target-is-multiclass-but-av
python, scikit-learn, svm, gridsearchcv
1,737,381,037
se_75089762
stackoverflow
MACHINE_LEARNING
I am using RuleFit for binary classification; how do I interpret the rules?
I am using RuleFit for binary classification; how do I interpret the rules? I am using RuleFit with a GradientBoostingClassifier to generate rules for a binary classification problem (health-dataset on Kaggle). When I print out the rules with RuleFit.get_rules(), it shows rule, type, coef, support, and importance. B...
https://stackoverflow.com/questions/75089762/i-am-using-rulefit-for-binary-classification-how-do-i-interpret-the-rules
machine-learning, scikit-learn
1,673,476,953
se_61292464
stackoverflow
MACHINE_LEARNING
Get confidence interval from sklearn linear regression in python
Get confidence interval from sklearn linear regression in python I want to get a confidence interval of the result of a linear regression. I'm working with the boston house price dataset. I've found this question: How to calculate the 99% confidence interval for the slope in a linear regression model in python? Howeve...
https://stackoverflow.com/questions/61292464/get-confidence-interval-from-sklearn-linear-regression-in-python
python, machine-learning, scikit-learn, statistics, linear-regression
1,587,226,950
se_34052115
stackoverflow
MACHINE_LEARNING
How to find the importance of the features for a logistic regression model?
How to find the importance of the features for a logistic regression model? I have a binary prediction model trained by logistic regression algorithm. I want know which features (predictors) are more important for the decision of positive or negative class. I know there is coef_ parameter which comes from the scikit-l...
https://stackoverflow.com/questions/34052115/how-to-find-the-importance-of-the-features-for-a-logistic-regression-model
python, machine-learning, scikit-learn, logistic-regression, feature-selection
1,449,087,081
se_18706863
stackoverflow
MACHINE_LEARNING
Difference between TruncatedSVD and svds
Difference between TruncatedSVD and svds I see that the documentation for both sklearn.decomposition.TruncatedSVD and scipy.sparse.linalg.svds mention that they both perform SVD for sparse matrices. What is the difference between them? Thanks.
https://stackoverflow.com/questions/18706863/difference-between-truncatedsvd-and-svds
scipy, scikit-learn, svd
1,378,760,083
se_79225855
stackoverflow
MACHINE_LEARNING
Cannot import name &#39;_check_array_key&#39; from &#39;skfda._utils&#39; in Python 3.12.7
Cannot import name &#39;_check_array_key&#39; from &#39;skfda._utils&#39; in Python 3.12.7 I am trying to use skfda library in my python code. I have already installed the package using `pip install scikit-fda, however, the error was a little bit strange for me. Can anyone explain why this keeps showing and how to fix...
https://stackoverflow.com/questions/79225855/cannot-import-name-check-array-key-from-skfda-utils-in-python-3-12-7
python, scikit-learn
1,732,609,147
se_61829228
stackoverflow
MACHINE_LEARNING
Latest XGboost and Sklearn giving keyerror
Latest XGboost and Sklearn giving keyerror xgb=XGBClassifier(objective="binary:logistic", n_estimators=100, random_state=42, eval_metric=["auc"]) xgb.fit(X_train, y_train) --------------------------------------------------------------------------- KeyError Traceback (most recent call ...
https://stackoverflow.com/questions/61829228/latest-xgboost-and-sklearn-giving-keyerror
scikit-learn, xgboost
1,589,564,722
se_9677603
stackoverflow
MACHINE_LEARNING
Naive Bayes classifier
Naive Bayes classifier I'm using scikit-learn for finding the Tf-idf weight of a document and then using the Naive Bayesian classifier to classify the text. But the Tf-idf weight of all words in a documents are negative except a few. But as far as I know, negative values means unimportant terms. So is it necessary to...
https://stackoverflow.com/questions/9677603/naive-bayes-classifier
machine-learning, scikit-learn, bayesian
1,331,605,724
se_69573659
stackoverflow
MACHINE_LEARNING
Custom SVM Polynomial kernel
Custom SVM Polynomial kernel I got asked as an assignment to develop a custom polynomial (degree = 3,4,5) kernel for SVM and compare its accuracy to the in-built poly kernel of sklearn (should be almost the same). I tried to follow the polynomial kernel definition but my results seems not to be quite similar, this is ...
https://stackoverflow.com/questions/69573659/custom-svm-polynomial-kernel
python, machine-learning, scikit-learn, svm, polynomial-math
1,634,226,368
se_79248908
stackoverflow
MACHINE_LEARNING
HistGradientBoostingClassifier Using Categorical Variables
HistGradientBoostingClassifier Using Categorical Variables I landed on the HistGradientBoostingClassifier because, according to the docs, it has native support for categorical variables without the need for one-hot encoding or label encoding. I tried to run categorical variables through the model but when I fit the mo...
https://stackoverflow.com/questions/79248908/histgradientboostingclassifier-using-categorical-variables
python, scikit-learn, classification, ensemble-learning
1,733,253,421
se_65980952
stackoverflow
MACHINE_LEARNING
Error: Could not install packages due to an OSError: [Errno 2] No such file or directory
Error: Could not install packages due to an OSError: [Errno 2] No such file or directory I try to use pip to install sklearn, and I receive the following error message: ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\Users\13434\AppData\Local\Packages\PythonSoftwareFounda...
https://stackoverflow.com/questions/65980952/error-could-not-install-packages-due-to-an-oserror-errno-2-no-such-file-or-d
python, scikit-learn, pip
1,612,107,381
se_74485762
stackoverflow
MACHINE_LEARNING
Scikit-Learn Linear Regression using Datetime Values and forecasting
Scikit-Learn Linear Regression using Datetime Values and forecasting Below is a sample of the dataset. row_id datetime energy 1 2008-03-01 00:00:00 1259.985563 2 2008-03-01 01:00:00 1095.541500 3 2008-03-01 02:00:00 1056.247500 4 2008-03-01 03:00:00 1034.742000 5 2008-03-01 04:00:00 1026.334500 The d...
https://stackoverflow.com/questions/74485762/scikit-learn-linear-regression-using-datetime-values-and-forecasting
python, pandas, datetime, scikit-learn, forecasting
1,668,753,451
se_75119268
stackoverflow
MACHINE_LEARNING
Can&#39;t get LogisticRegressionCV to converge for any other Cs then 1
Can&#39;t get LogisticRegressionCV to converge for any other Cs then 1 I'm trying to build a logistic regression model with an array of hyperparameter values such as: lambdas = [0.001, 0.01, 0.05, 0.1, 1., 100.] However, the model won't converge unless i have Cs = 1.Here is my code: X_train, X_test, y_train, y_test = ...
https://stackoverflow.com/questions/75119268/cant-get-logisticregressioncv-to-converge-for-any-other-cs-then-1
scikit-learn, logistic-regression, cross-validation
1,673,712,043
se_77701188
stackoverflow
MACHINE_LEARNING
How to get features selected using Boruta in a Pandas Dataframe with headers
How to get features selected using Boruta in a Pandas Dataframe with headers I have this boruta code, and I want to generate the results in pandas with columns included model = RandomForestRegressor(n_estimators=100, max_depth=5, random_state=42) # let's initialize Boruta feat_selector = BorutaPy( verbose=2, ...
https://stackoverflow.com/questions/77701188/how-to-get-features-selected-using-boruta-in-a-pandas-dataframe-with-headers
python, pandas, filter, scikit-learn, feature-selection
1,703,204,982
se_39048407
stackoverflow
MACHINE_LEARNING
Importing scikit-learn in ipython/Jupyter notebook
Importing scikit-learn in ipython/Jupyter notebook I am able to import scikit-learn from python or ipython console (both python 2.7 and 3.5), but when I do import sklearn within an ipython notebook (again, either 2.7 or 3.5) I get the error message below. How can I fix this? ImportError ...
https://stackoverflow.com/questions/39048407/importing-scikit-learn-in-ipython-jupyter-notebook
scikit-learn, jupyter
1,471,645,079
se_79529836
stackoverflow
MACHINE_LEARNING
TabPFN feature selection raises KeyError(f&quot;None of [{key}] are in the [{axis_name}]&quot;)
TabPFN feature selection raises KeyError(f&quot;None of [{key}] are in the [{axis_name}]&quot;) I trained a tabPFN model, which I then tried applying a sequential feature selector for important feature selection. I've been getting this error KeyError(f"None of [{key}] are in the [{axis_name}]") on the following code:...
https://stackoverflow.com/questions/79529836/tabpfn-feature-selection-raises-keyerrorfnone-of-key-are-in-the-axis-nam
python, machine-learning, scikit-learn, feature-selection
1,742,770,762
se_79528929
stackoverflow
MACHINE_LEARNING
Why does SequentialFeatureSelector return at most &quot;n_features_in_ - 1&quot; predictors?
Why does SequentialFeatureSelector return at most &quot;n_features_in_ - 1&quot; predictors? I have a training dataset with six features and I am using SequentialFeatureSelector to find an "optimal" subset of the features for a linear regression model. The following code returns three features, which I will call X1, X...
https://stackoverflow.com/questions/79528929/why-does-sequentialfeatureselector-return-at-most-n-features-in-1-predictor
python, machine-learning, scikit-learn, linear-regression, sequentialfeatureselector
1,742,732,163
se_53035563
stackoverflow
MACHINE_LEARNING
Sentiment Analysis, Naive Bayes Accuracy
Sentiment Analysis, Naive Bayes Accuracy I'm trying to form a Naive Bayes Classifier script for sentiment classification of tweets. I'm pasting my whole code here, because I know I will get hell if I don't. So I basically I use NLTK's corpuses as training data, and then some tweets I scraped as test data. I pre-proces...
https://stackoverflow.com/questions/53035563/sentiment-analysis-naive-bayes-accuracy
python, scikit-learn, nltk, sentiment-analysis, naivebayes
1,540,756,774
se_73006073
stackoverflow
MACHINE_LEARNING
How to apply linear regression to subsets of a dataframe using groupby
How to apply linear regression to subsets of a dataframe using groupby I want to apply linear regression and predict values to subsets of my original data by V1, V2, V3, V4, V5, and V6. Then I want to store dataframe with names: V1, V2, V3, V4, V5, V6, time, Predicted value. How to achieve it effificiently? What I hav...
https://stackoverflow.com/questions/73006073/how-to-apply-linear-regression-to-subsets-of-a-dataframe-using-groupby
python, pandas, scikit-learn, group-by, apply
1,657,990,267