Search in sources :

Example 6 with XgboostAdapter

use of org.dkpro.tc.ml.xgboost.XgboostAdapter in project dkpro-tc by dkpro.

the class XgboostSaveAndLoadModelDocumentRegression method regressionGetParameterSpace.

private ParameterSpace regressionGetParameterSpace() throws Exception {
    Map<String, Object> dimReaders = new HashMap<String, Object>();
    CollectionReaderDescription readerTrain = CollectionReaderFactory.createReaderDescription(LinewiseTextOutcomeReader.class, LinewiseTextOutcomeReader.PARAM_OUTCOME_INDEX, 0, LinewiseTextOutcomeReader.PARAM_TEXT_INDEX, 1, LinewiseTextOutcomeReader.PARAM_LANGUAGE, "en", LinewiseTextOutcomeReader.PARAM_SOURCE_LOCATION, "src/main/resources/data/essays/train/essay_train.txt", LinewiseTextOutcomeReader.PARAM_LANGUAGE, "en");
    dimReaders.put(DIM_READER_TRAIN, readerTrain);
    @SuppressWarnings("unchecked") Dimension<List<Object>> dimClassificationArgs = Dimension.create(DIM_CLASSIFICATION_ARGS, Arrays.asList(new Object[] { new XgboostAdapter(), "booster=gblinear", "reg:logistic" }));
    Dimension<TcFeatureSet> dimFeatureSets = Dimension.create(DIM_FEATURE_SET, new TcFeatureSet(TcFeatureFactory.create(SentenceRatioPerDocument.class), TcFeatureFactory.create(WordNGram.class), TcFeatureFactory.create(TokenRatioPerDocument.class)));
    ParameterSpace pSpace = new ParameterSpace(Dimension.createBundle("readers", dimReaders), Dimension.create(DIM_LEARNING_MODE, LM_REGRESSION), Dimension.create(DIM_FEATURE_MODE, FM_DOCUMENT), dimFeatureSets, dimClassificationArgs);
    return pSpace;
}
Also used : CollectionReaderDescription(org.apache.uima.collection.CollectionReaderDescription) HashMap(java.util.HashMap) ParameterSpace(org.dkpro.lab.task.ParameterSpace) XgboostAdapter(org.dkpro.tc.ml.xgboost.XgboostAdapter) ArrayList(java.util.ArrayList) List(java.util.List) TcFeatureSet(org.dkpro.tc.api.features.TcFeatureSet)

Aggregations

HashMap (java.util.HashMap)6 CollectionReaderDescription (org.apache.uima.collection.CollectionReaderDescription)6 ParameterSpace (org.dkpro.lab.task.ParameterSpace)6 TcFeatureSet (org.dkpro.tc.api.features.TcFeatureSet)6 XgboostAdapter (org.dkpro.tc.ml.xgboost.XgboostAdapter)6 Map (java.util.Map)5 LiblinearAdapter (org.dkpro.tc.ml.liblinear.LiblinearAdapter)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 LibsvmAdapter (org.dkpro.tc.ml.libsvm.LibsvmAdapter)1 WekaAdapter (org.dkpro.tc.ml.weka.WekaAdapter)1 LinearRegression (weka.classifiers.functions.LinearRegression)1