Member-only story

Use sklearn’s neural network to predict on podcast listening times

Crystal X
5 min readApr 4, 2025

It doesn’t matter what I am engaged in, I always try to fit Kaggle’s monthly playground competition into my schedule. This month required the data scientist to predict the length of time that an individual would listen to a podcast.

While I have used a linear regression model to make predictions in the past I opted to try out a nonlinear model in this competition.

MLPRegressor in scikit-learn is a multi-layer perceptron (MLP) regressor, which is a type of neural network used for regression tasks. It learns complex relationships between input features and a continuous target variable.

Key Features of MLPRegressor

  • Hidden Layers: You can specify the number of hidden layers and neurons in each layer using hidden_layer_sizes=(100,), where 100 represents the number of neurons in the single hidden layer.
  • Activation Functions: Supports activation functions like ReLU, tanh, logistic, and identity.
  • Optimization Solvers: Uses Adam, SGD, or LBFGS for weight optimization.
  • Regularization: Includes L2 regularization (alpha parameter) to prevent overfitting.
  • Learning Rate: Can be constant, adaptive, or inverse scaling.

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet