Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoML #790

Merged
merged 141 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
bef4f1d
auto ml framework
bluesjjw Nov 8, 2018
1a504c5
initial work of RF in Angel
bluesjjw Nov 12, 2018
10835df
DT learner and params
bluesjjw Nov 13, 2018
004a56f
compile clean version
bluesjjw Nov 15, 2018
2befb12
format code
bluesjjw Nov 15, 2018
8eeecc9
RFLearner, refine strategy, add MLConf
bluesjjw Nov 16, 2018
e8f5b51
parse random forest configs
bluesjjw Nov 19, 2018
91b9407
param parser
bluesjjw Nov 20, 2018
b11114b
add conf and strategy
bluesjjw Nov 20, 2018
8ae7f62
basic data structure
bluesjjw Nov 20, 2018
ae89439
models for DT and RF
bluesjjw Nov 20, 2018
fdb7990
improve basic data structure
bluesjjw Nov 21, 2018
a236c34
chech tree num and assign trees
bluesjjw Nov 21, 2018
2886848
error of task assignment
bluesjjw Nov 22, 2018
30929f2
bug fix of config parser
bluesjjw Nov 23, 2018
6262f2a
bug fix, rm log
bluesjjw Nov 23, 2018
2744e62
reconstruct automl framework
bluesjjw Dec 6, 2018
78b34e6
import error
bluesjjw Dec 6, 2018
948b351
Revert "import error"
bluesjjw Dec 6, 2018
2115a89
Revert "reconstruct automl framework"
bluesjjw Dec 6, 2018
4ce9861
reconstruct to spark.ml API
bluesjjw Dec 7, 2018
4c4227d
conf of preprocess, dataframe loader, a start of preprocess
bluesjjw Dec 11, 2018
56efbc3
add tokenizer and stopwordremover
bluesjjw Dec 12, 2018
caa0c7b
bug fix
bluesjjw Dec 12, 2018
557b1ee
bug fix
bluesjjw Dec 12, 2018
0d74c0b
implement Sampler with Transformer
bluesjjw Dec 12, 2018
fa00dab
add seed to Sampler
bluesjjw Dec 12, 2018
0a38e82
wrapper of spark.ml transformer
bluesjjw Dec 14, 2018
d194a94
code format
bluesjjw Dec 14, 2018
256b413
Merge pull request #583 from bluesjjw/Auto-ML-jeremy
paynie Dec 14, 2018
d070c98
relations of Transformer inputs and outputs
bluesjjw Dec 17, 2018
5a234a4
improve transformer wrapper, gennerate input and output
bluesjjw Dec 17, 2018
97a2982
implement several transformer wrapper
bluesjjw Dec 17, 2018
3e3bccf
build pipeline automatically
bluesjjw Dec 17, 2018
97faed4
Merge pull request #584 from bluesjjw/Auto-ML-jeremy
bluesjjw Dec 17, 2018
39d7bdb
covariance kernel
bluesjjw Dec 20, 2018
ca9f647
square distance for kernel
bluesjjw Dec 20, 2018
28cd24a
cholesky decomposition and matrix det
bluesjjw Dec 20, 2018
0091f46
data parser for breeze vector
bluesjjw Dec 20, 2018
551e737
use array instead of list
bluesjjw Dec 20, 2018
4bcc63a
bug fix of covariance function
bluesjjw Dec 22, 2018
0045052
new covariance function: square exp
bluesjjw Dec 22, 2018
d2f8445
covar type, log likelihood, kernel diff function
bluesjjw Dec 22, 2018
5e249b9
GP model and surrogate
bluesjjw Dec 22, 2018
36ded18
UT of dist function
bluesjjw Dec 22, 2018
03cc7fa
Merge pull request #594 from bluesjjw/Auto-ML-jeremy
bluesjjw Dec 26, 2018
85df943
bug fix of GP model
bluesjjw Dec 26, 2018
af39939
GP surrogate and tuner example
bluesjjw Dec 26, 2018
9f32cf9
Merge pull request #598 from bluesjjw/Auto-ML-jeremy
bluesjjw Dec 26, 2018
f511410
Merge branch 'branch-2.0.1' into Auto-ML
bluesjjw Dec 26, 2018
b35e73e
refine constructer
bluesjjw Dec 26, 2018
5998638
avoid redundant sample
bluesjjw Dec 27, 2018
ae10db3
fix negtive variance error
bluesjjw Dec 27, 2018
c76ce14
more friendly constructor for ParamSpace
bluesjjw Dec 27, 2018
6d30f70
init auto learner
bluesjjw Dec 27, 2018
0d9008c
bug fix of covariance
bluesjjw Dec 27, 2018
9faa80d
auto learner, reset param, and an example
bluesjjw Dec 28, 2018
00e0594
basic architecture of auto feature
xuehuanran Dec 29, 2018
3ef6cd7
minimize bug gix
bluesjjw Jan 2, 2019
46011f5
Merge branch 'Auto-ML' of https://github.com/Angel-ML/angel into Auto-ML
xuehuanran Jan 3, 2019
3e46fbf
automl module
bluesjjw Jan 4, 2019
245b443
rm useless import
bluesjjw Jan 4, 2019
451ee7b
Merge branch 'Auto-ML' of https://github.com/Angel-ML/angel into Auto-ML
xuehuanran Jan 4, 2019
c3572bb
automl examples
bluesjjw Jan 4, 2019
582beef
rm debug log
bluesjjw Jan 4, 2019
d9e9cc2
revise pom
bluesjjw Jan 4, 2019
bfe87e5
create PipelineWrapper and PipelineDriver
xuehuanran Jan 4, 2019
e5ddfe3
bug fix
bluesjjw Jan 10, 2019
a6efb79
Merge branch 'Auto-ML' of https://github.com/Angel-ML/angel into Auto-ML
xuehuanran Jan 11, 2019
a2967f5
Add random-search and grid-search
zwt233 Jan 16, 2019
a09a43c
Add BreezeOpTest
zwt233 Jan 16, 2019
8085b06
Merge pull request #608 from xuehuanran/Auto-ML
bluesjjw Jan 16, 2019
fc3e793
Merge branch 'Auto-ML' of https://github.com/Angel-ML/angel into Auto-ML
zwt233 Jan 16, 2019
9c71a43
bug fix of preprocess
bluesjjw Jan 16, 2019
2f0c8ad
Merge branch 'Auto-ML' of https://github.com/Angel-ML/angel into Auto-ML
xuehuanran Jan 16, 2019
56ae5fd
Merge branch 'Auto-ML' of https://github.com/zwt233/angel into Auto-ML
zwt233 Jan 16, 2019
10ed2cf
Fix the wrong definition of EI
zwt233 Jan 16, 2019
9e250bd
Merge branch 'Auto-ML' of https://github.com/zwt233/angel into Auto-ML
zwt233 Jan 16, 2019
644801c
Merge pull request #625 from zwt233/Auto-ML
bluesjjw Jan 17, 2019
7a24a26
code format
bluesjjw Jan 17, 2019
7b14536
Refactor the code of Random-search and Grid-search so that they can w…
zwt233 Jan 23, 2019
c8951aa
Fix the bug of Grid-search
zwt233 Jan 23, 2019
270f70a
Add some test cases
zwt233 Jan 23, 2019
f1289e7
Merge branch 'Auto-ML' into Auto-ML
zwt233 Jan 23, 2019
8b0443a
add some wrappers of text preprocess and a pipelineTest
xuehuanran Feb 14, 2019
2303b61
Merge branch 'Auto-ML' of https://github.com/Angel-ML/angel into Auto-ML
xuehuanran Feb 14, 2019
42674db
refine config interface
bluesjjw Feb 15, 2019
fde2972
Merge pull request #661 from xuehuanran/Auto-ML
bluesjjw Feb 18, 2019
e87e902
implement the function to choose the surrogate and rename some classes
zwt233 Feb 19, 2019
ed4b2ff
Update the configuration space and its use in the test cases.
zwt233 Feb 19, 2019
d91dcc4
Update the configuration space and its use in the test cases.
zwt233 Feb 19, 2019
05e6b1b
cartesian product, vector filter
bluesjjw Feb 28, 2019
747dcc1
bug fix: no valid config
bluesjjw Mar 4, 2019
0dec977
bug fix: pass update given empty array
bluesjjw Mar 4, 2019
d7af5a6
Merge pull request #635 from zwt233/Auto-ML
bluesjjw Mar 5, 2019
4e2152f
update two-order cross
bluesjjw Mar 6, 2019
4718ed2
skip test
bluesjjw Mar 6, 2019
4cb657a
add input conf
bluesjjw Mar 6, 2019
c54d4bc
Create Lasso, RandomForest, Variance Selector and FeatureSelectorTest
xuehuanran Mar 13, 2019
dfef005
reformat code
bluesjjw Mar 13, 2019
2ea162a
use new Solver interface
bluesjjw Mar 13, 2019
dac5e08
sort cofficients according to the absolute value, match the return ve…
xuehuanran Mar 13, 2019
f2d900e
Merge pull request #693 from xuehuanran/Auto-ML
bluesjjw Mar 14, 2019
c0ac7dc
selector supports both DenseVector and SparseVector
bluesjjw Mar 15, 2019
26272f4
self cartesian
bluesjjw Mar 16, 2019
73853af
add ut test
bluesjjw Mar 16, 2019
33b43d0
fix empty config bugs
bluesjjw Mar 16, 2019
5abf6c5
add ut test of tuner
bluesjjw Mar 16, 2019
0143396
revise grid search
bluesjjw Mar 16, 2019
3a0cea2
remove random seed, add RF ut
bluesjjw Mar 16, 2019
64e577f
remove useless example
bluesjjw Mar 16, 2019
f5f7fac
refine variance selector with spark.ml interface
bluesjjw Mar 18, 2019
736b8c1
add distributed feature cross and selector example
bluesjjw Mar 19, 2019
e6ad92d
refine ut test for feature cross
bluesjjw Mar 19, 2019
6e99fc6
add UT for three order feature cross
bluesjjw Mar 20, 2019
ffd74ab
bug fix: support grid search for continuous space
bluesjjw Mar 21, 2019
7df9146
bug fix: selector should output sparse vector
bluesjjw Mar 21, 2019
9b096a8
refine example and ut
bluesjjw Mar 21, 2019
6bbcc73
bug fix: BinaryLogisticRegressionSummary interface error
bluesjjw Mar 22, 2019
87780bd
bug fix: one param returns a simgle vector
bluesjjw Mar 22, 2019
c5b5fa4
reduce tolerance of LBFGS for GP
bluesjjw Mar 26, 2019
9fd6712
Add FtestSelector, fix the problem of the filterIndices, add setNumTo…
xuehuanran Mar 26, 2019
44e690c
Merge pull request #700 from xuehuanran/Auto-ML
bluesjjw Apr 3, 2019
cca7419
handle not converge exception
bluesjjw Apr 9, 2019
2452dbd
fix convergence failure in GP EM algorithm
bluesjjw Apr 11, 2019
1294506
change log
bluesjjw Apr 11, 2019
27211af
1 add the PipelineWrapperModel in the PileWrapper to drop Intermediat…
xuehuanran May 15, 2019
df62b53
change spark version, auto offline learner and runner
bluesjjw May 16, 2019
2339790
change scope of lib for automl
bluesjjw May 19, 2019
00f7a0d
integration of Angel and auto tuning
bluesjjw May 20, 2019
6346229
parse conf to set params of auto tuner
bluesjjw May 23, 2019
d29e2a7
Merge pull request #772 from xuehuanran/Auto-ML
bluesjjw May 27, 2019
437a6d7
Solve conflicts
zwt233 May 27, 2019
8e2fac5
Merge pull request #776 from zwt233/Auto-ML
bluesjjw May 28, 2019
bbb6f94
refactor earsly stopping
bluesjjw May 30, 2019
4b521b3
dependency error
bluesjjw May 31, 2019
b01417d
fix bug: firstFlow might be reversed if not set split(0)
bluesjjw Jun 3, 2019
4d42fe9
Revert "fix bug: firstFlow might be reversed if not set split(0)"
bluesjjw Jun 3, 2019
604033f
merge branch-2.2.0, fix conflits
bluesjjw Jun 8, 2019
8a37afd
trainer returns metrics
bluesjjw Jun 9, 2019
d984d22
tune the hyper-parameters of GBDT
bluesjjw Jun 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto

import com.tencent.angel.ml.auto.acquisition.optimizer.{AcqOptimizer, RandomSearch}
import com.tencent.angel.ml.auto.acquisition.{Acquisition, EI}
import com.tencent.angel.ml.auto.config.ConfigurationSpace
import com.tencent.angel.ml.auto.parameter.{ContinuousSpace, DiscreteSpace, ParamSpace}
import com.tencent.angel.ml.auto.setting.Setting
import com.tencent.angel.ml.auto.solver.{Solver, SolverWithTrail}
import com.tencent.angel.ml.auto.surrogate.{RFSurrogate, Surrogate}
import com.tencent.angel.ml.auto.trail.{TestTrail, Trail}
import com.tencent.angel.ml.math2.vector.IntFloatVector

object Example extends App {

override def main(args: Array[String]): Unit = {
val param1: ParamSpace[Float] = new ContinuousSpace("param1", 0, 10, 11)
val param2: ParamSpace[Float] = new ContinuousSpace("param2", -5, 5, 11)
val param3: ParamSpace[Float] = new DiscreteSpace[Float]("param3", List(0.0f, 1.0f, 3.0f, 5.0f))
val param4: ParamSpace[Float] = new DiscreteSpace[Float]("param4", List(-5.0f, -3.0f, 0.0f, 3.0f, 5.0f))
val cs: ConfigurationSpace = new ConfigurationSpace("cs")
cs.addParam(param1)
cs.addParam(param2)
cs.addParam(param3)
cs.addParam(param4)
Setting.setBatchSize(1)
Setting.setSampleSize(100)
val sur: Surrogate = new RFSurrogate(cs.paramNum, true)
val acq: Acquisition = new EI(sur, 0.1f)
val opt: AcqOptimizer = new RandomSearch(acq, cs)
val solver: Solver = new Solver(cs, sur, acq, opt)
val trail: Trail = new TestTrail()
val runner: SolverWithTrail = new SolverWithTrail(solver, trail)
val result: (IntFloatVector, Float) = runner.run(100)
sur.stop()
println(s"Best configuration ${result._1.getStorage.getValues.mkString(",")}, best performance: ${result._2}")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto.acquisition

import com.tencent.angel.ml.auto.surrogate.Surrogate
import com.tencent.angel.ml.math2.vector.IntFloatVector

/**
* Abstract base class for acquisition function
*/
abstract class Acquisition(val surrogate: Surrogate) {

/**
* Computes the acquisition value for a given point X
*
* @param X : (1, D), the input points where the acquisition function should be evaluated.
* @return (1, 1) Expected Improvement of X, (1, D) Derivative of Expected Improvement at X
*/
def compute(X: IntFloatVector, derivative: Boolean = false): (Float, IntFloatVector)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto.acquisition

import com.tencent.angel.ml.auto.surrogate.Surrogate
import com.tencent.angel.ml.math2.storage.IntFloatDenseVectorStorage
import com.tencent.angel.ml.math2.vector.IntFloatVector
import org.apache.commons.logging.{Log, LogFactory}
import org.apache.commons.math3.distribution.NormalDistribution

/**
* Expected improvement.
* @param surrogate
* @param par : Controls the balance between exploration and exploitation of the acquisition function, default=0.0
*
*/
class EI(override val surrogate: Surrogate, val par: Float) extends Acquisition(surrogate) {
val LOG: Log = LogFactory.getLog(classOf[Surrogate])

override def compute(X: IntFloatVector, derivative: Boolean = false): (Float, IntFloatVector) = {
val pred = surrogate.predict(X) // (mean, variance)

// Use the best seen observation as incumbent
val eta: Float = surrogate.curBest._2
//println(s"best seen result: $eta")

val s: Float = Math.sqrt(pred._2).toFloat

if (s == 0) {
// if std is zero, we have observed x on all instances
// using a RF, std should be never exactly 0.0
(0.0f, new IntFloatVector(X.dim().toInt, new IntFloatDenseVectorStorage()))
} else {
val z = (eta - pred._1 - par) / s
val norm: NormalDistribution = new NormalDistribution
val cdf: Double = norm.cumulativeProbability(z)
val pdf: Double = norm.density(z)
val f = s * (z * cdf + pdf)
println(s"cur best: $eta, z: $z, cdf: $cdf, pdf: $pdf, f: $f")
(f.toFloat, new IntFloatVector(X.dim().toInt, new IntFloatDenseVectorStorage()))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto.acquisition.optimizer

import com.tencent.angel.ml.auto.acquisition.Acquisition
import com.tencent.angel.ml.auto.config.{Configuration,ConfigurationSpace}

/**
* Abstract base class for acquisition maximization.
* @param acqFunc : The acquisition function which will be maximized
* @param configSpace : Configuration space of parameters
*/
abstract class AcqOptimizer(val acqFunc: Acquisition, val configSpace: ConfigurationSpace) {

/**
* Maximizes the given acquisition function.
*
* @param numPoints : Number of queried points.
* @return A set of tuple(acquisition value, Configuration).
*/
def maximize(numPoints: Int, sorted: Boolean = true): List[(Float, Configuration)]

def maximize: (Float, Configuration)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto.acquisition.optimizer

import com.tencent.angel.ml.auto.acquisition.Acquisition
import com.tencent.angel.ml.auto.config.{Configuration, ConfigurationSpace}

/**
* Implementation of local search.
*
* @param acqFunc : The acquisition function which will be maximized
* @param configSpace : Configuration space of parameters
* @param epsilon : In order to perform a local move one of the incumbent's neighbors needs at least an improvement higher than epsilon
* @param numIters : Maximum number of iterations that the local search will perform
*/
class LocalSearch(override val acqFunc: Acquisition, override val configSpace: ConfigurationSpace,
epsilon: String, numIters: Int)
extends AcqOptimizer(acqFunc, configSpace) {

/**
* Starts a local search from the given start point and quits if either the max number of steps is reached or
* no neighbor with an higher improvement was found
*
* @param numPoints : Number of queried points.
* @return A set of tuple(acquisition_value, Configuration).
*/
override def maximize(numPoints: Int, sorted: Boolean = true): List[(Float, Configuration)] = ???

override def maximize: (Float, Configuration) = ???
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto.acquisition.optimizer

import com.tencent.angel.ml.auto.acquisition.Acquisition
import com.tencent.angel.ml.auto.config.{Configuration, ConfigurationSpace}
import com.tencent.angel.ml.auto.setting.Setting
import org.apache.commons.logging.{Log, LogFactory}

import scala.util.Random

/**
* Get candidate solutions via random sampling of configurations.
*
* @param acqFunc : The acquisition function which will be maximized
* @param configSpace : Configuration space of parameters
* @param seed
*/
class RandomSearch(override val acqFunc: Acquisition, override val configSpace: ConfigurationSpace,
seed: Int = 100) extends AcqOptimizer(acqFunc, configSpace) {
val LOG: Log = LogFactory.getLog(classOf[RandomSearch])

val rd = new Random(seed)

override def maximize(numPoints: Int, sorted: Boolean = true): List[(Float, Configuration)] = {
//println(s"maximize RandomSearch")
val configs: List[Configuration] = configSpace.sampleConfig(Setting.sampleSize)
configs.foreach( config => println(s"sample a configuration: ${config.getVector.getStorage.getValues.mkString(",")}"))
if (sorted)
configs.map{config => (acqFunc.compute(config.getVector)._1, config)}.sortWith(_._1 > _._1).take(numPoints)
else
rd.shuffle(configs.map{config => (0.0f, config)}).take(numPoints)
}

override def maximize: (Float, Configuration) = {
maximize(1, true).head
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/


package com.tencent.angel.ml.auto.config

import com.tencent.angel.ml.math2.vector.IntFloatVector

/**
* A single configuration
*
* @param configSpace : The configuration space for this configuration
* @param vector : A vector for efficient representation of configuration.
*/
class Configuration(configSpace: ConfigurationSpace, vector: IntFloatVector) {

def getVector: IntFloatVector = vector

def getValues: List[Float] = vector.getStorage.getValues.toList

def keys: List[String] = configSpace.param2Idx.keys.toList

def get(name: String): Float = get(configSpace.param2Idx.getOrElse(name, -1))

def get(idx: Int): Float = vector.get(idx)

def contains(name: String): Boolean = configSpace.param2Idx.contains(name)
}
Loading