56 lines
1.5 KiB
Python
Executable file
56 lines
1.5 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Tue May 24 08:11:05 2022
|
|
|
|
@author: tanu
|
|
"""
|
|
|
|
# my function
|
|
#import fsgs from UQ_FS_fn
|
|
|
|
fsgs(input_df = X
|
|
, target = y
|
|
, param_gridLd = param_grid_abc
|
|
, blind_test_df = X_bts
|
|
, blind_test_target = y_bts
|
|
, estimator = AdaBoostClassifier(**rs)
|
|
, var_type = 'mixed')
|
|
|
|
ds_lrD = fsgs(input_df = X
|
|
, target = y
|
|
, param_gridLd = param_grid_lr
|
|
, blind_test_df = X_bts
|
|
, blind_test_target = y_bts
|
|
, estimator = LogisticRegression(**rs)
|
|
, var_type = 'mixed')
|
|
|
|
# RF: without fs + hyperparam
|
|
rf_allF = fsgs(input_df = X
|
|
, target = y
|
|
, param_gridLd = param_grid_rf
|
|
, blind_test_df = X_bts
|
|
, blind_test_target = y_bts
|
|
, estimator = RandomForestClassifier(**rs, **njobs, bootstrap = True, oob_score = True)
|
|
, var_type = 'mixed')
|
|
|
|
#Fitting 10 folds for each of 31104 candidates, totalling 311040 fits
|
|
|
|
|
|
|
|
##############################################################################
|
|
#========================================
|
|
# Write final output file
|
|
# https://stackoverflow.com/questions/19201290/how-to-save-a-dictionary-to-a-file
|
|
#========================================
|
|
# #output final dict as a json
|
|
# outFile = 'LR_FS.json'
|
|
# with open(outFile, 'w') as f:
|
|
# f.write(json.dumps(output_modelD,cls=NpEncoder))
|
|
|
|
# # read json
|
|
# file = 'LR_FS.json'
|
|
# with open(file, 'r') as f:
|
|
# data = json.load(f)
|
|
##############################################################################
|
|
|