forked from microsoft/nni
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from Microsoft/master
merge master
- Loading branch information
Showing
41 changed files
with
1,899 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
authorName: default | ||
experimentName: example_auto-gbdt-metis | ||
trialConcurrency: 1 | ||
maxExecDuration: 10h | ||
maxTrialNum: 10 | ||
#choice: local, remote, pai | ||
trainingServicePlatform: local | ||
searchSpacePath: search_space_metis.json | ||
#choice: true, false | ||
useAnnotation: false | ||
tuner: | ||
#choice: TPE, Random, Anneal, Evolution, BatchTuner | ||
#SMAC (SMAC should be installed through nnictl) | ||
builtinTunerName: MetisTuner | ||
classArgs: | ||
#choice: maximize, minimize | ||
optimize_mode: minimize | ||
trial: | ||
command: python3 main.py | ||
codeDir: . | ||
gpuNum: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pip install lightgbm | ||
lightgbm | ||
pandas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"num_leaves":{"_type":"choice","_value":[31, 28, 24, 20]}, | ||
"learning_rate":{"_type":"choice","_value":[0.01, 0.05, 0.1, 0.2]}, | ||
"bagging_freq":{"_type":"choice","_value":[1, 2, 4, 8, 10]} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ numpy==1.14.2 | |
tensorflow==1.12.0 | ||
torchvision==0.2.1 | ||
Keras==2.2.2 | ||
nni==0.3.0 | ||
nni==0.4.1 | ||
torch==0.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/sdk/pynni/nni/metis_tuner/Regression_GMM/CreateModel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright (c) Microsoft Corporation | ||
# All rights reserved. | ||
# | ||
# MIT License | ||
# | ||
# Permission is hereby granted, free of charge, | ||
# to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, | ||
# including without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and | ||
# to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
import os | ||
import sys | ||
from operator import itemgetter | ||
|
||
import sklearn.mixture as mm | ||
|
||
sys.path.insert(1, os.path.join(sys.path[0], '..')) | ||
|
||
|
||
def create_model(samples_x, samples_y_aggregation, percentage_goodbatch=0.34): | ||
''' | ||
Create the Gaussian Mixture Model | ||
''' | ||
samples = [samples_x[i] + [samples_y_aggregation[i]] for i in range(0, len(samples_x))] | ||
|
||
# Sorts so that we can get the top samples | ||
samples = sorted(samples, key=itemgetter(-1)) | ||
samples_goodbatch_size = int(len(samples) * percentage_goodbatch) | ||
samples_goodbatch = samples[0:samples_goodbatch_size] | ||
samples_badbatch = samples[samples_goodbatch_size:] | ||
|
||
samples_x_goodbatch = [sample_goodbatch[0:-1] for sample_goodbatch in samples_goodbatch] | ||
#samples_y_goodbatch = [sample_goodbatch[-1] for sample_goodbatch in samples_goodbatch] | ||
samples_x_badbatch = [sample_badbatch[0:-1] for sample_badbatch in samples_badbatch] | ||
|
||
# === Trains GMM clustering models === # | ||
#sys.stderr.write("[%s] Train GMM's GMM model\n" % (os.path.basename(__file__))) | ||
bgmm_goodbatch = mm.BayesianGaussianMixture(n_components=max(1, samples_goodbatch_size - 1)) | ||
bad_n_components = max(1, len(samples_x) - samples_goodbatch_size - 1) | ||
bgmm_badbatch = mm.BayesianGaussianMixture(n_components=bad_n_components) | ||
bgmm_goodbatch.fit(samples_x_goodbatch) | ||
bgmm_badbatch.fit(samples_x_badbatch) | ||
|
||
model = {} | ||
model['clusteringmodel_good'] = bgmm_goodbatch | ||
model['clusteringmodel_bad'] = bgmm_badbatch | ||
return model | ||
|
Oops, something went wrong.