Skip to content
Advertisement

Tag: machine-learning

how to apply a class function to replace NaN for mean within a subset of pandas df columns?

The class is composed of a set of attributes and functions including: Attributes: df : a pandas dataframe. numerical_feature_names: df columns with a numeric value. label_column_names: df string columns to be grouped. Functions: mean(nums): takes a list of numbers as input and returns the mean fill_na(df, numerical_feature_names, label_columns): takes class attributes as inputs and returns a transformed df. And here’s

NoSuchElementException: Failed to find a default value for layers in MultiLayerPerceptronClassifier

I am having a problem running a prediction using a saved MultiLayerPerceptronClassifier model. It throws error: The original mlpc in the pipeline had layers defined: My attempts to solve it: If I run the pipeline model and do predictions without first saving the model. I works with no error. But saving and re-using the model throws this error. Any help

How to build a custom scaler based on StandardScaler?

I am trying to build a custom scaler to scale only the continuous variables on a dataset (the US Adult Income: https://www.kaggle.com/uciml/adult-census-income), using StandardScaler as a base. Here is my Python code that I used: However when I tried to run the scaler, I met this problem: So what is the error that I have on building the scaler? And

Cross-validation with time series data in sklearn

I have a question with regard to cross-validation of time series data in general. The problem is macro forecasting, e.g. forecasting the 1-month ahead Price of the S&P500 using different monthly macro variables. Now I read about the following approach: One should/could use a rolling cross-validation approach. I.e. always drop an old monthly value and add a new one (=

__init__() got an unexpected keyword argument ‘handle_unknown’

I’m trying to Ordinal Encode my categorical features using sklearn, but I get the error __init__() got an unexpected keyword argument ‘handle_unknown’ when I compile the below code: A sample data to reproduce the error: Could someone please tell me what’s wrong in my code? Answer You are most likely not using an appropriate version of scikit-learn. handle_unknown and unknown_value

Advertisement