Skip to main content

Stacking algorithm optimisation

Project description

Prostate_cancer_related_research

介绍

研究前列腺癌的低中高风险分层问题

对stacking算法进行优化

安装教程

  1. pip install stackingNT

使用说明

  1. 您需要传入您的base model pool、meta model

classifiers_ = {

    'RandomForest': RandomForestClassifier(random_state=random_seed, n_estimators=100, max_depth=None),

    'DecisionTree': DecisionTreeClassifier(random_state=random_seed),

    'XGBoost': XGBClassifier(reg_lambda=0.5,

                             max_depth=8,

                             learning_rate=0.93,

                             n_estimators=100, 

                             min_child_weight=1,

                             gamma=0.3,

                             # min_weight=5,

                             colsample_bytree=0.8,

                             verbosity=0,

                             num_class=len(n_classes),

                             objective='multi:softmax',

                             random_state=random_seed),

    # 'AdaBoost': AdaBoostClassifier(n_estimators=100, learning_rate=0.9, random_state=random_seed),

    'LogisticRegression':LogisticRegression(random_state=random_seed),

    'SVM': SVC(kernel='linear', C=1, probability=True, tol=1.e-4, random_state=random_seed),

}



base_models = classifiers_

meta_model = {'SVM': SVC(kernel='linear', C=1, probability=True, tol=1.e-4, random_state=random_seed)}

具体的传入模型过程如下:


from stackingNT import StackingNonlinearTransformations

meta_model = {'SVM': SVC(kernel='linear', C=1, probability=True, tol=1.e-4, random_state=random_seed)}

base_models = classifiers_

SNT = StackingNonlinearTransformations(base_models, meta_model)

  1. SNT.fit()使用说明:

传入参数:

train_X=train_df_lassoCV, train_y=Y, test_X=test_df_lassoCV, test_y=Y_test,NT="relu"

train_X、train_y、test_X、test_y分别代表训练集和测试集。NT代表一种非线性变换的方法。(有关非线性变换具体介绍可参考论文:Predictions of Prostate Cancer Risk Stratification Based on A Non-Linear Transformation Stacking Learning Strategy)

具体fit函数调用如下所示:


train_pred, test_pred, train_pred_prob, test_pred_prob = SNT.fit(train_X=train_df_lassoCV, train_y=Y, test_X=test_df_lassoCV, test_y=Y_test,NT="relu")



train_pred:训练集预测值

test_pred:测试集预测值

train_pred_prob:训练集预测概率

test_pred_prob :测试集预测概率

相关论文:

Predictions of Prostate Cancer Risk Stratification Based on A Non-Linear Transformation Stacking Learning Strategy

Project details


Download files

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

Source Distribution

stackingNT-0.0.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stackingNT-0.0.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file stackingNT-0.0.2.tar.gz.

File metadata

  • Download URL: stackingNT-0.0.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.12

File hashes

Hashes for stackingNT-0.0.2.tar.gz
Algorithm Hash digest
SHA256 df3499f47eb0400db23df9448b1633ef7d8162777d3b38ce4abd8856c94acc6d
MD5 ba353bb15f0865bd289c10c063dafa0d
BLAKE2b-256 6bdaf99e9cdefe94e4671c94855507d3c4093af1be883ea9e65410f6b5010b70

See more details on using hashes here.

File details

Details for the file stackingNT-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: stackingNT-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.12

File hashes

Hashes for stackingNT-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a81ec1f6dbcac6f72de4e9a04586150812da2bcdb9cf04a7088b80cff7306c1
MD5 a6d98b2bf4cfa81c75ac45b4bf7583e2
BLAKE2b-256 174d127dadfab60cfdf3bac9ef93192e43dede67ccaca88a25037b7ab5abf2cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page