Skip to content
Permalink
Browse files

Updated interfaces for ml.

  • Loading branch information...
mwever committed Aug 31, 2019
1 parent 1cb70ae commit b637a379f181a4cdbece7b38993e203a1c667871
Showing with 82 additions and 24 deletions.
  1. +1 −1 .../src/main/java/org/api4/java/ai/graphsearch/problem/pathsearch/pathevaluation/IPathEvaluator.java
  2. +13 −0 .../org/api4/java/ai/ml/classification/singlelabel/learner/ISingleLabelClassificationPrediction.java
  3. +4 −0 .../src/main/java/org/api4/java/ai/ml/classification/singlelabel/learner/ISingleLabelClassifier.java
  4. +2 −0 ai/ml/src/main/java/org/api4/java/ai/ml/core/dataset/schema/attribute/IAttributeValue.java
  5. +2 −2 ...i4/java/ai/ml/core/dataset/schema/attribute/{INominalAttribute.java → ICategoricalAttribute.java}
  6. +11 −0 ...l/src/main/java/org/api4/java/ai/ml/core/dataset/schema/attribute/ICategoricalAttributeValue.java
  7. +2 −2 ai/ml/src/main/java/org/api4/java/ai/ml/core/dataset/schema/attribute/IMultiLabelAttributeValue.java
  8. +0 −8 ai/ml/src/main/java/org/api4/java/ai/ml/core/dataset/schema/attribute/INominalAttributeValue.java
  9. +3 −0 ai/ml/src/main/java/org/api4/java/ai/ml/core/dataset/schema/attribute/INumericAttributeValue.java
  10. +3 −0 ai/ml/src/main/java/org/api4/java/ai/ml/core/dataset/schema/attribute/IStringAttributeValue.java
  11. +3 −3 ai/ml/src/main/java/org/api4/java/ai/ml/core/dataset/splitter/IDatasetSplitter.java
  12. +8 −0 ai/ml/src/main/java/org/api4/java/ai/ml/core/evaluation/package-info.java
  13. +7 −0 ai/ml/src/main/java/org/api4/java/ai/ml/ranking/IRankingPrediction.java
  14. +1 −1 ai/ml/src/main/java/org/api4/java/ai/ml/ranking/dyad/dataset/IDyadRankingInstance.java
  15. +11 −0 ai/ml/src/main/java/org/api4/java/ai/ml/ranking/label/learner/ILabelRankingPrediction.java
  16. +5 −0 ai/ml/src/main/java/org/api4/java/ai/ml/ranking/learner/IRanker.java
  17. +2 −2 build.gradle
  18. +3 −4 common/src/main/java/org/api4/java/common/attributedobjects/IObjectEvaluator.java
  19. +1 −1 gradle/wrapper/gradle-wrapper.properties
@@ -5,5 +5,5 @@

public interface IPathEvaluator<N, A, V extends Comparable<V>> extends IObjectEvaluator<IPath<N, A>, V> {
@Override
public V evaluate(IPath<N, A> path) throws PathEvaluationException, InterruptedException;
public V f(IPath<N, A> path) throws PathEvaluationException, InterruptedException;
}
@@ -0,0 +1,13 @@
package org.api4.java.ai.ml.classification.singlelabel.learner;

import org.api4.java.ai.ml.core.learner.algorithm.IPrediction;

public interface ISingleLabelClassificationPrediction extends IPrediction {

public String getLabelWithHighestProbability();

public double[] getClassDistribution();

public double getProbabilityOfLabel(String label);

}
@@ -3,6 +3,7 @@
import org.api4.java.ai.ml.classification.IClassifier;
import org.api4.java.ai.ml.classification.singlelabel.dataset.ISingleLabelClassificationDataset;
import org.api4.java.ai.ml.classification.singlelabel.dataset.ISingleLabelClassificationInstance;
import org.api4.java.ai.ml.core.exception.PredictionException;

/**
*
@@ -11,4 +12,7 @@
*/
public interface ISingleLabelClassifier extends IClassifier<ISingleLabelClassificationInstance, ISingleLabelClassificationDataset> {

@Override
public ISingleLabelClassificationPrediction predict(ISingleLabelClassificationInstance instance) throws PredictionException, InterruptedException;

}
@@ -2,6 +2,8 @@

public interface IAttributeValue {

public IAttribute getAttribute();

public Object getValue();

}
@@ -2,13 +2,13 @@

import java.util.List;

public interface INominalAttribute extends IAttribute {
public interface ICategoricalAttribute extends IAttribute {

public List<String> getValues();

public boolean isBinary();

@Override
public INominalAttributeValue getAsAttributeValue(Object obj);
public ICategoricalAttributeValue getAsAttributeValue(Object obj);

}
@@ -0,0 +1,11 @@
package org.api4.java.ai.ml.core.dataset.schema.attribute;

public interface ICategoricalAttributeValue extends IAttributeValue {

@Override
public String getValue();

@Override
public ICategoricalAttribute getAttribute();

}
@@ -1,10 +1,10 @@
package org.api4.java.ai.ml.core.dataset.schema.attribute;

import java.util.Set;
import java.util.Collection;

public interface IMultiLabelAttributeValue extends IAttributeValue {

@Override
public Set<String> getValue();
public Collection<String> getValue();

}

This file was deleted.

@@ -5,4 +5,7 @@
@Override
public Double getValue();

@Override
public INumericAttribute getAttribute();

}
@@ -5,4 +5,7 @@
@Override
public String getValue();

@Override
public IStringAttribute getAttribute();

}
@@ -8,10 +8,10 @@

public interface IDatasetSplitter<I extends IInstance, D extends IDataset<I>> {

public List<IDataset<I>> split(D data, long seed) throws SplitFailedException, InterruptedException;
public List<D> split(D data, long seed) throws SplitFailedException, InterruptedException;

default List<IDataset<I>> split(final D data) throws SplitFailedException, InterruptedException {
return split(data, new Random().nextLong());
default List<D> split(final D data) throws SplitFailedException, InterruptedException {
return this.split(data, new Random().nextLong());
}

}
@@ -0,0 +1,8 @@
/**
*
*/
/**
* @author mwever
*
*/
package org.api4.java.ai.ml.core.evaluation;
@@ -0,0 +1,7 @@
package org.api4.java.ai.ml.ranking;

import org.api4.java.ai.ml.core.learner.algorithm.IPrediction;

public interface IRankingPrediction extends IPrediction {

}
@@ -2,6 +2,6 @@

import org.api4.java.ai.ml.ranking.dataset.IRankingInstance;

public interface IDyadRankingInstance extends IRankingInstance<IDyad> {
public interface IDyadRankingInstance extends IRankingInstance<IDyad>, Iterable<IDyad> {

}
@@ -0,0 +1,11 @@
package org.api4.java.ai.ml.ranking.label.learner;

import org.api4.java.ai.ml.core.learner.algorithm.IPrediction;
import org.api4.java.ai.ml.ranking.dataset.IRanking;

public interface ILabelRankingPrediction extends IPrediction {

@Override
public IRanking<String> getPrediction();

}
@@ -1,6 +1,8 @@
package org.api4.java.ai.ml.ranking.learner;

import org.api4.java.ai.ml.core.exception.PredictionException;
import org.api4.java.ai.ml.core.learner.ISupervisedLearner;
import org.api4.java.ai.ml.ranking.IRankingPrediction;
import org.api4.java.ai.ml.ranking.dataset.IRankingDataset;
import org.api4.java.ai.ml.ranking.dataset.IRankingInstance;

@@ -14,4 +16,7 @@
*/
public interface IRanker<O, I extends IRankingInstance<O>, D extends IRankingDataset<O, I>> extends ISupervisedLearner<I, D> {

@Override
public IRankingPrediction predict(I iTest) throws PredictionException, InterruptedException;

}
@@ -37,8 +37,8 @@ allprojects {
apply plugin: 'nebula.maven-base-publish'

//Java version
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 12
targetCompatibility = 12

//Project properties
project.group = 'org.api4'
@@ -1,16 +1,15 @@
package org.api4.java.common.attributedobjects;

public interface IObjectEvaluator<T, V extends Comparable<V>> extends IGetter<T, V> {
public V evaluate(T object) throws InterruptedException, ObjectEvaluationFailedException;
public V f(T object) throws InterruptedException, ObjectEvaluationFailedException;

@Override
default V getPropertyOf(final T object) throws GetPropertyFailedException, InterruptedException {
try {
return evaluate(object);
return this.f(object);
} catch (InterruptedException e) {
throw e;
}
catch (ObjectEvaluationFailedException e) {
} catch (ObjectEvaluationFailedException e) {
throw new GetPropertyFailedException(e);
}
}
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip

0 comments on commit b637a37

Please sign in to comment.
You can’t perform that action at this time.