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

[SW-2445] Add logic of FrameUtils.guessParserSetup to Sparkling Water #2329

Merged
merged 2 commits into from Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions extensions/src/main/scala/water/fvec/H2OFrame.scala
Expand Up @@ -24,7 +24,7 @@ import water._
import water.parser.DefaultParserProviders.GUESS_INFO
import water.parser.ParseSetup
import water.parser.ParseSetup._
import water.util.FrameUtils
import water.H2O

/**
* Wrapper around Java H2O Frame
Expand Down Expand Up @@ -179,6 +179,8 @@ object H2OFrame {
* @param uris URIs of files to parse
* @return guessed parser setup
*/
def parserSetup(userSetup: ParseSetup, uris: URI*): ParseSetup =
FrameUtils.guessParserSetup(defaultParserSetup(), uris: _*)
def parserSetup(userSetup: ParseSetup, uris: URI*): ParseSetup = {
val inKeys = uris.map(H2O.getPM.anyURIToKey(_)).toArray
return ParseSetup.guessSetup(inKeys, userSetup)
}
}
Expand Up @@ -84,6 +84,7 @@ class MOJOParameterTestSuite extends FunSuite with SharedH2OTestContext with Mat
val algorithm = new H2OGAM()
.setLabelCol("CAPSULE")
.setSeed(1)
.setLambdaValue(Array(0.5))
.setGamCols(Array("PSA", "AGE"))
.setNumKnots(Array(5, 5))
.setBs(Array(5, 5))
Expand Down
Expand Up @@ -49,7 +49,8 @@ def testGLMParameters(prostateDataset):

def testGAMParameters(prostateDataset):
features = ['AGE', 'RACE', 'DPROS', 'DCAPS', 'PSA']
algorithm = H2OGAM(seed=1, labelCol="CAPSULE", gamCols=["PSA", "AGE"], numKnots=[5, 5], featuresCols=features)
algorithm = H2OGAM(seed=1, labelCol="CAPSULE", gamCols=["PSA", "AGE"], numKnots=[5, 5], lambdaValue=[0.5],
featuresCols=features)
model = algorithm.fit(prostateDataset)
compareParameterValues(algorithm, model, ["getFeaturesCols"])

Expand Down