All Questions
Tagged with numpy scikit-learn
2,274
questions
0
votes
1
answer
45
views
Issue with Custom Rounding Function in Python Pandas
I have implemented a custom rounding function in Python using Pandas, but it's not producing the expected results in certain cases. It basically should always round down to the nearest step.Here's the ...
0
votes
0
answers
18
views
How to "average out" multiple curves with sklearn Lasso regression?
The lecture slides here: https://www.cs.cmu.edu/~ggordon/10725-F12/slides/09-acceleration.pdf on page show multiple lines on a convergence plot apparently "averaged out" with Lasso ...
0
votes
1
answer
35
views
Scikit-Learn's feature_names_in Method
A number of scikit-learn's classes have a feature_names_in method, which would be a real time saver if I could understand it better. Specifically, assume your X is a nested list of strings [['A', 'B',...
0
votes
0
answers
25
views
Python3 skglm - 'Poisson' object has no attribute 'get_lipschitz'
Im working with count data and want to fit a poisson regression with a L1 norm. I have the following code which throws the error and is reproducable:
import numpy as np
import skglm
import sklearn
X =...
1
vote
1
answer
38
views
How to save single Random Forest model with cross validation?
I am using 10 fold cross validation, trying to predict binary labels (Y) based on the embedding inputs (X).
I want to save one of the models (perhaps the one with the highest ROC AUC). I'm not sure ...
1
vote
0
answers
32
views
scikit-learn: ValueError: Input contains NaN, infinity or a value too large for dtype('float64') while predicting with GP
I've been using scikit-learn for Gaussian process regressors for a while, working with adaptively constructed models where the existing GP is used to select new datapoints for the GP. Recently I've ...
2
votes
2
answers
73
views
Nearest neighbor for list of arrays
`I have a list of arrays like this (in x, y coordinates):
coordinates= array([[ 300, 2300],
[ 670, 2360],
[ 400, 2300]]), array([[1500, 1960],
[1620, 2200],
[1505, 1975]]), ...
0
votes
0
answers
34
views
circumvent 250mb layer limit
I've a python serverless project that relies on scikit-learn, pandas, numpy and sqlachemy.
Combined size of these package is around 350MB which is 100MB more than allowed layer size. Is there any way ...
0
votes
1
answer
30
views
Using sklearn for hierarchical classification
I was wondering if hierarchical classifications are supported by the sciki-learn library. I am dealing with the 3 classes divided by 6 subclasses each, such as:
import numpy as np
from sklearn.tree ...
3
votes
0
answers
172
views
How to add a .transform Nystroem method to project new observations into an existing space? (Diffusion Maps in Python)
I am copying over some code from mapalign for calculating diffusion maps using the sklearn api. Currently, there is no .transform method so I've forked the repo and I'm trying to add it myself but I'...
0
votes
1
answer
49
views
AttributeError: can't set attribute: How do I fix this this class to work well?
Given the following SMOTEBoost class implementeation in smoteboost.py file:
import numbers
import numpy as np
from collections import Counter
from sklearn.base import (clone,
...
0
votes
0
answers
34
views
Attempting to perform One Hot Encoding on ndarray produces a value error when a non-categorical data column is not specified
I have an ndarray called "data" that I need to perform One Hot Encoding on for preparation that looks something like this but much longer.
| ID | DevID | Colour | Hours |
| -------- | -------...
0
votes
1
answer
45
views
Find the threshold that returns the highest precision
I have this dataset:
(26.5625,0)
(29.5625,0)
(30.390625,0)
(18.640625,0)
(27.984375,0)
(26.984375,0)
(25.703125,0)
(25.78125,0)
(32.09375,0)
(25.59375,0)
(27.703125,0)
(30.828125,0)
(23.578125,0)
(21....
0
votes
1
answer
84
views
How to perform matthews_corrcoef in sklearn simultaneously between every column using a matrix X and and output y?
I want to calculate the Matthews correlation coefficient (MCC) in sklearn between every column of a matrix X with an output y. Here is my code:
from sklearn.metrics import matthews_corrcoef
import ...
2
votes
2
answers
115
views
How to perform matthews_corrcoef in sklearn simultaneously for every column using a matrix?
I want to perform Matthews correlation coefficient (MCC) in sklearn to find the correlation between different features (boolean vectors) in a 2D numpyarray. What I have done so far is to loop through ...