本文整理汇总了Java中hex.pca.PCAModel类的典型用法代码示例。如果您正苦于以下问题:Java PCAModel类的具体用法?Java PCAModel怎么用?Java PCAModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PCAModel类属于hex.pca包,在下文中一共展示了PCAModel类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBasic
import hex.pca.PCAModel; //导入依赖的package包/类
@Test public void testBasic() throws InterruptedException, ExecutionException{
boolean standardize = true;
PCAModel model = null;
Frame fr = null;
try {
Key kraw = Key.make("basicdata.raw");
FVecTest.makeByteVec(kraw, "x1,x2,x3\n0,1.0,-120.4\n1,0.5,89.3\n2,0.3333333,291.0\n3,0.25,-2.5\n4,0.20,-2.5\n5,0.1666667,-123.4\n6,0.1428571,-0.1\n7,0.1250000,18.3");
fr = ParseDataset2.parse(Key.make("basicdata.hex"), new Key[]{kraw});
Key kpca = Key.make("basicdata.pca");
new PCA("PCA on basic small dataset", kpca, fr, 0.0, standardize).invoke();
model = DKV.get(kpca).get();
Job.JobState jstate = model.get_params().state;
Assert.assertTrue(jstate == Job.JobState.DONE); //HEX-1817
testHTML(model);
} finally {
if( fr != null ) fr .delete();
if( model != null ) model.delete();
}
}
示例2: testLinDep
import hex.pca.PCAModel; //导入依赖的package包/类
@Test public void testLinDep() throws InterruptedException, ExecutionException {
Key kdata = Key.make("depdata.hex");
PCAModel model = null;
Frame fr = null;
double[] sdev_R = {1.414214, 0};
try {
Key kraw = Key.make("depdata.raw");
FVecTest.makeByteVec(kraw, "x1,x2\n0,0\n1,2\n2,4\n3,6\n4,8\n5,10");
fr = ParseDataset2.parse(kdata, new Key[]{kraw});
Key kpca = Key.make("depdata.pca");
new PCA("PCA on data with dependent cols", kpca, fr, 0.0, true).invoke();
model = DKV.get(kpca).get();
testHTML(model);
for(int i = 0; i < model.sdev().length; i++)
Assert.assertEquals(sdev_R[i], model.sdev()[i], threshold);
} finally {
if( fr != null ) fr .delete();
if( model != null ) model.delete();
}
}
示例3: mapTypeahead
import hex.pca.PCAModel; //导入依赖的package包/类
protected static Class mapTypeahead(Class c) {
if(c != null) {
if( PCAModel.class.isAssignableFrom(c) )
return TypeaheadPCAModelKeyRequest.class;
if( NBModel.class.isAssignableFrom(c) )
return TypeaheadNBModelKeyRequest.class;
if( Model.class.isAssignableFrom(c))
return TypeaheadModelKeyRequest.class;
if( Frame.class.isAssignableFrom(c) )
return TypeaheadHexKeyRequest.class;
}
return TypeaheadKeysRequest.class;
}
示例4: initTest
import hex.pca.PCAModel; //导入依赖的package包/类
@BeforeClass
static public void initTest() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
H2O.NAME = "Test cloud";
// Add a new item into TYPE_MAP
Field fMap = TypeMap.class.getDeclaredField("MAP");
fMap.setAccessible(true);
Map<String,Integer> map = (Map<String, Integer>) fMap.get(null);
map.put(PCAModel.class.getName(), 1000);
}
示例5: testHTML
import hex.pca.PCAModel; //导入依赖的package包/类
private final void testHTML(PCAModel m) {
StringBuilder sb = new StringBuilder();
PCAModelView pcav = new PCAModelView();
pcav.pca_model = m;
pcav.toHTML(sb);
assert(sb.length() > 0);
}
示例6: testArrests
import hex.pca.PCAModel; //导入依赖的package包/类
@Test public void testArrests() throws InterruptedException, ExecutionException {
double tol = 0.25;
boolean standardize = true;
PCAModel model = null;
Frame fr = null;
double[] sdev_R = {1.5748783, 0.9948694, 0.5971291, 0.4164494};
double[][] eigv_R = {{-0.5358995, 0.4181809, -0.3412327, 0.64922780},
{-0.5831836, 0.1879856, -0.2681484, -0.74340748},
{-0.2781909, -0.8728062, -0.3780158, 0.13387773},
{-0.5434321, -0.1673186, 0.8177779, 0.08902432}};
try {
Key ksrc = Key.make("arrests.hex");
fr = getFrameForFile(ksrc, "smalldata/pca_test/USArrests.csv", null);
// Build PCA model on all columns
Key kdst = Key.make("arrests.pca");
new PCA("PCA test on USArrests", kdst, fr, tol, standardize).invoke();
model = DKV.get(kdst).get();
testHTML(model);
// Compare standard deviation and eigenvectors to R results
checkSdev(sdev_R, model.sdev());
checkEigvec(eigv_R, model.eigVec());
// Score original data set using PCA model
// Key kscore = Key.make("arrests.score");
// Frame score = PCAScoreTask.score(df, model._eigVec, kscore);
} finally {
if( fr != null ) fr .delete();
if( model != null ) model.delete();
}
}
示例7: buildModel
import hex.pca.PCAModel; //导入依赖的package包/类
@Override
public ModelBuilder buildModel(PCAModel.PCAParameters params) {
return new PCA(params);
}
示例8: getModelFactory
import hex.pca.PCAModel; //导入依赖的package包/类
@Override
protected ModelFactory<PCAModel.PCAParameters> getModelFactory() {
return ModelFactories.PCA_MODEL_FACTORY;
}
示例9: createImpl
import hex.pca.PCAModel; //导入依赖的package包/类
@Override public PCAModel createImpl() {
PCAModel.PCAParameters parms = parameters.createImpl();
return new PCAModel( model_id.key(), parms, null );
}
示例10: TypeaheadPCAModelKeyRequest
import hex.pca.PCAModel; //导入依赖的package包/类
public TypeaheadPCAModelKeyRequest() {
super("Provides a simple JSON array of filtered keys known to the "+
"current node that are PCAModels at the time of calling.",
null,PCAModel.class);
}