├── .gitignore ├── LICENSE ├── README.md ├── pom.xml └── src ├── main └── java │ └── it │ └── uniroma2 │ └── sag │ └── kelp │ ├── data │ └── examplegenerator │ │ ├── SequenceExampleGenerator.java │ │ ├── SequenceExampleGeneratorKernel.java │ │ ├── SequenceExampleGeneratorLinear.java │ │ └── SequenceExampleGeneratorTypeResolver.java │ ├── learningalgorithm │ ├── MultiEpochLearning.java │ ├── PassiveAggressive.java │ ├── budgetedAlgorithm │ │ ├── BudgetedLearningAlgorithm.java │ │ ├── RandomizedBudgetPerceptron.java │ │ └── Stoptron.java │ ├── classification │ │ ├── dcd │ │ │ ├── DCDLearningAlgorithm.java │ │ │ └── DCDLoss.java │ │ ├── hmm │ │ │ ├── SequenceClassificationKernelBasedLearningAlgorithm.java │ │ │ ├── SequenceClassificationLearningAlgorithm.java │ │ │ └── SequenceClassificationLinearLearningAlgorithm.java │ │ ├── liblinear │ │ │ ├── LibLinearLearningAlgorithm.java │ │ │ └── solver │ │ │ │ ├── COPYRIGHT │ │ │ │ ├── L2R_L2_SvcFunction.java │ │ │ │ ├── L2R_L2_SvrFunction.java │ │ │ │ ├── LibLinearFeature.java │ │ │ │ ├── LibLinearFeatureNode.java │ │ │ │ ├── Problem.java │ │ │ │ ├── Tron.java │ │ │ │ └── TronFunction.java │ │ ├── passiveaggressive │ │ │ ├── BudgetedPassiveAggressiveClassification.java │ │ │ ├── KernelizedPassiveAggressiveClassification.java │ │ │ ├── LinearPassiveAggressiveClassification.java │ │ │ └── PassiveAggressiveClassification.java │ │ ├── pegasos │ │ │ └── PegasosLearningAlgorithm.java │ │ ├── perceptron │ │ │ ├── KernelizedPerceptron.java │ │ │ ├── LinearPerceptron.java │ │ │ └── Perceptron.java │ │ ├── probabilityestimator │ │ │ └── platt │ │ │ │ ├── BinaryPlattNormalizer.java │ │ │ │ ├── MulticlassPlattNormalizer.java │ │ │ │ ├── PlattInputElement.java │ │ │ │ ├── PlattInputList.java │ │ │ │ └── PlattMethod.java │ │ └── scw │ │ │ ├── SCWType.java │ │ │ └── SoftConfidenceWeightedClassification.java │ ├── clustering │ │ └── kernelbasedkmeans │ │ │ ├── KernelBasedKMeansEngine.java │ │ │ └── KernelBasedKMeansExample.java │ └── regression │ │ ├── liblinear │ │ └── LibLinearRegression.java │ │ └── passiveaggressive │ │ ├── KernelizedPassiveAggressiveRegression.java │ │ ├── LinearPassiveAggressiveRegression.java │ │ └── PassiveAggressiveRegression.java │ ├── linearization │ ├── LinearizationFunction.java │ └── nystrom │ │ ├── NystromMethod.java │ │ └── NystromMethodEnsemble.java │ ├── predictionfunction │ ├── SequencePrediction.java │ ├── SequencePredictionFunction.java │ └── model │ │ └── SequenceModel.java │ └── utils │ └── evaluation │ ├── ClusteringEvaluator.java │ └── MulticlassSequenceClassificationEvaluator.java └── test ├── java └── it │ └── uniroma2 │ └── sag │ └── kelp │ ├── algorithms │ ├── binary │ │ └── liblinear │ │ │ └── LibLinearDenseVsSparseClassificationEvaluator.java │ └── incrementalTrain │ │ └── IncrementalTrainTest.java │ └── learningalgorithm │ └── classification │ └── hmm │ ├── SequenceLearningKernelTest.java │ └── SequenceLearningLinearTest.java └── resources ├── sequence_learning ├── README.txt ├── declaration_of_independence.klp.gz ├── gettysburg_address.klp.gz ├── prediction_test_kernel.txt └── prediction_test_linear.txt └── svmTest └── binary ├── binary_test.klp ├── binary_train.klp └── liblinear └── polarity_sparse_dense_repr.txt.gz /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | .settings 11 | .project 12 | .classpath 13 | target 14 | 15 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 16 | hs_err_pid* 17 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | it.uniroma2.sag.kelp 4 | kelp-additional-algorithms 5 | 2.2.4-SNAPSHOT 6 | kelp-additional-algorithms 7 | http://www.kelp-ml.org 8 | 9 | Semantic Analytics Group @ Uniroma2 10 | http://sag.art.uniroma2.it 11 | 12 | 13 | 14 | sfilice 15 | Simone Filice 16 | simone.filice@gmail.com 17 | http://sag.art.uniroma2.it/people/filice/ 18 | SAG group @University of Roma Tor Vergata 19 | http://sag.art.uniroma2.it/ 20 | 21 | 22 | dcroce 23 | Danilo Croce 24 | croce@info.uniroma2.it 25 | http://sag.art.uniroma2.it/people/croce/ 26 | SAG group @University of Roma Tor Vergata 27 | http://sag.art.uniroma2.it/ 28 | 29 | 30 | gcastellucci 31 | Giuseppe Castellucci 32 | castellucci.giuseppe@gmail.com 33 | http://sag.art.uniroma2.it/people/castellucci/ 34 | SAG group @University of Roma Tor Vergata 35 | http://sag.art.uniroma2.it/ 36 | 37 | 38 | 39 | https://github.com/SAG-KeLP/kelp-additional-algorithms 40 | scm:git:https://github.com/SAG-KeLP/kelp-additional-algorithms.git 41 | scm:git:https://github.com/SAG-KeLP/kelp-additional-algorithms.git 42 | HEAD 43 | 44 | 45 | 46 | kelp_repo_release 47 | Sag Libs Repository Stable 48 | http://sag.art.uniroma2.it:8081/artifactory/kelp-release/ 49 | 50 | 51 | kelp_repo_snap 52 | Sag Libs Repository Snapshots 53 | http://sag.art.uniroma2.it:8081/artifactory/kelp-snapshot/ 54 | 55 | 56 | 57 | 58 | kelp_repo_snap 59 | Sag Libs Repository Snapshots 60 | 61 | false 62 | always 63 | warn 64 | 65 | 66 | true 67 | always 68 | fail 69 | 70 | http://sag.art.uniroma2.it:8081/artifactory/kelp-snapshot/ 71 | 72 | 73 | kelp_repo_release 74 | Sag Libs Repository Stable 75 | 76 | true 77 | always 78 | warn 79 | 80 | 81 | false 82 | always 83 | fail 84 | 85 | http://sag.art.uniroma2.it:8081/artifactory/kelp-release/ 86 | 87 | 88 | 89 | 90 | it.uniroma2.sag.kelp 91 | kelp-core 92 | ${project.version} 93 | 94 | 95 | org.apache.commons 96 | commons-math3 97 | 3.2 98 | 99 | 100 | 101 | 102 | 103 | src/main/resources 104 | 105 | **/* 106 | 107 | 108 | 109 | src/test/resources 110 | 111 | **/* 112 | 113 | 114 | 115 | 116 | 117 | org.apache.maven.plugins 118 | maven-compiler-plugin 119 | 3.1 120 | 121 | 1.6 122 | 1.6 123 | 124 | 125 | 126 | maven-source-plugin 127 | 2.1.1 128 | 129 | 130 | bundle-sources 131 | package 132 | 133 | jar-no-fork 134 | 135 | 136 | 137 | 138 | 139 | external.atlassian.jgitflow 140 | jgitflow-maven-plugin 141 | 1.0-m5.1 142 | 143 | https://github.com/SAG-KeLP/kelp-additional-algorithms.git 144 | 145 | master 146 | development 147 | version 148 | 149 | true 150 | true 151 | ${kelp.git.user} 152 | ${kelp.git.password} 153 | ${developmentVersion} 154 | ${releaseVersion} 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /src/main/java/it/uniroma2/sag/kelp/data/examplegenerator/SequenceExampleGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Simone Filice and Giuseppe Castellucci and Danilo Croce and Roberto Basili 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package it.uniroma2.sag.kelp.data.examplegenerator; 17 | 18 | import it.uniroma2.sag.kelp.data.example.Example; 19 | import it.uniroma2.sag.kelp.data.example.SequenceExample; 20 | import it.uniroma2.sag.kelp.data.example.SequencePath; 21 | 22 | import java.io.Serializable; 23 | 24 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 25 | import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; 26 | 27 | /** 28 | * A SequenceExampleGenerator generates a copy of an input 29 | * Example (reflecting an item in a SequenceExample) 30 | * enriched with information derived from the