Skip to main content

a library used for stacking based on scikit-learn

Project description



SKNet is a new type of neural network that is simple in structure but complex in neuron. Each of its neuron is a traditional estimator such as SVM, RF, etc.


We think that such a network has many applicable scenarios.

  • We don't have enough samples to train neural networks.
  • We hope to improve the accuracy of the model by means of emsemble.
  • We hope to learn some new features.
  • We want to save a lot of parameter adjustment time while getting a stable and good model.


pip install sknet


Computation Graph


from sknet.sequential import Layer,Sequential,SKNeuron

from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import AdaBoostRegressor
from sklearn.ensemble import ExtraTreesRegressor
from sklearn.svm import LinearSVR
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.neighbors import KNeighborsRegressor

from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

data = load_breast_cancer()
features =
target =

X_train, X_test, y_train, y_test = train_test_split(features, target, test_size=0.2, random_state=42)

layer1 = Layer([
    SKNeuron(RandomForestRegressor,params = {"random_state": 0}),
    SKNeuron(GradientBoostingRegressor,params = {"random_state": 0}),
    SKNeuron(AdaBoostRegressor,params = {"random_state": 0}),
    SKNeuron(ExtraTreesRegressor,params = {"random_state": 0}),

layer2 = Layer([
    SKNeuron(AdaBoostRegressor,params = {"random_state": 0}),
    SKNeuron(LinearSVR,params = {"random_state": 0}),

layer3 = Layer([
    SKNeuron(LogisticRegression,params = {"random_state": 0}),

model = Sequential([layer1,layer2,layer3],n_splits = 5)
y_pred = model.fit_predict(X_train,y_train, X_test)

# acc = 0.9736842105263158


  • Two or three level stacking
  • multi-processing
  • features proxy

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for SKNet, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size SKNet-0.0.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page