Skip to content

Commit

Permalink
feat - add an example for logistic regression
Browse files Browse the repository at this point in the history
  • Loading branch information
ksachdeva committed Oct 21, 2019
1 parent 6b4509f commit 4efefe2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
56 changes: 56 additions & 0 deletions examples/pca_logistic.nni.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
sknni: 0.1

# Datasource is how you specify which callable
# sknni will invoke to get the data
dataSource:
reader: sknni.datasource.NpzClassificationSource
params:
# Note - dir_path is a parameter name for NpzClassificationSource
# if you create another datasource then specify the arguments of the callable
# as per your datasource
dir_path: /Users/ksachdeva/Desktop/Dev/myoss/scikit-nni/examples/data/multiclass-classification

# This is how you specify a pipeline and steps
# In this example there are 3 steps - normalizer, pca and logistic regression
# Please note that you would have to specify the fully qualified name for the classes
sklearnPipeline:
name: normalizer_svc
steps:
normalizer: sklearn.preprocessing.Normalizer
pca: sklearn.decomposition.PCA
logistic_regression: sklearn.linear_model.LogisticRegression

# This section is more or less compliant with the NNI's
# way of specifying the hyper parameters except that you
# should specify them with their corresponding step using the
# same name as you used earlier in the pipeline definition
nniConfigSearchSpace:
# do not need any params for normalizer as default is L2
# and for this classification task L2 is what is needed
- pca:
n_components:
_type: choice
_value: [64,128]
- logistic_regression:
C:
_type: uniform
_value: [0.1,1]


# This is exactly same as the one that of NNI
# except that you do not have to specify the command
# and code fields. They are automatically added by the sknni generator
nniConfig:
authorName: ksachdeva
experimentName: pca-logistic-regression
trialConcurrency: 1
maxExecDuration: 1h
maxTrialNum: 100
trainingServicePlatform: local
useAnnotation: false
tuner:
builtinTunerName: TPE
classArgs:
optimize_mode: maximize
trial:
gpuNum: 0
2 changes: 1 addition & 1 deletion examples/pca_svc.nni.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dataSource:
dir_path: /Users/ksachdeva/Desktop/Dev/myoss/scikit-nni/examples/data/multiclass-classification

# This is how you specify a pipeline and steps
# In this example there are two steps - normalizer and svc
# In this example there are 3 steps - normalizer, pca and svc
# Please note that you would have to specify the fully qualified name for the classes
sklearnPipeline:
name: normalizer_svc
Expand Down

0 comments on commit 4efefe2

Please sign in to comment.