Class WekaInstanceSet<U>
java.lang.Object
es.uam.eps.ir.relison.links.data.ml.weka.WekaInstanceSet<U>
public class WekaInstanceSet<U>
extends java.lang.Object
Instance set to use with Weka classifiers.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<U,java.util.Map<U,java.lang.Integer>>
destInstances
A map that links the (u,v) link with the instance, indexed by the destination node.private weka.core.FastVector
features
The information about the different features in the dataset.private int
numInstances
The total number of instances.private java.util.Map<U,java.util.Map<U,java.lang.Integer>>
origInstances
A map that links the (u,v) link with the instance, indexed by the origin node.private java.util.List<Pair<U>>
users
The set of user pairs in the instance set.private weka.core.Instances
values
The set of Weka instances of the dataset. -
Constructor Summary
Constructors Constructor Description WekaInstanceSet(weka.core.FastVector features, java.lang.String name)
Constructor. -
Method Summary
Modifier and Type Method Description void
addInstance(U u, U v, weka.core.Instance instance)
Adds a pattern associated to a given edge.weka.core.FastVector
getFeatures()
Obtains the vector containing the attributes.weka.core.Instance
getInstance(U u, U v)
Obtains an individual instance.java.util.Map<Pair<U>,java.lang.Integer>
getInstanceMap()
Obtains a relationship between pairs of users and instances.weka.core.Instances
getInstances()
Obtains the whole set of instances.java.util.Map<U,weka.core.Instance>
getInstancesWithDest(U v)
Gets the set of instances which have a user as destination of the edge.java.util.Map<U,weka.core.Instance>
getInstancesWithOrigin(U u)
Gets the set of instances which have a user as origin of the edge.
-
Field Details
-
features
private final weka.core.FastVector featuresThe information about the different features in the dataset. -
values
private final weka.core.Instances valuesThe set of Weka instances of the dataset. -
origInstances
A map that links the (u,v) link with the instance, indexed by the origin node. -
destInstances
A map that links the (u,v) link with the instance, indexed by the destination node. -
users
The set of user pairs in the instance set. -
numInstances
private int numInstancesThe total number of instances.
-
-
Constructor Details
-
WekaInstanceSet
public WekaInstanceSet(weka.core.FastVector features, java.lang.String name)Constructor.- Parameters:
features
- the information about the features in the dataset.name
- name of the dataset (f.ex: train/test).
-
-
Method Details
-
addInstance
Adds a pattern associated to a given edge.- Parameters:
u
- the origin user.v
- the destination user.instance
- the pattern.
-
getInstances
public weka.core.Instances getInstances()Obtains the whole set of instances.- Returns:
- the whole set of instances.
-
getFeatures
public weka.core.FastVector getFeatures()Obtains the vector containing the attributes.- Returns:
- the attributes.
-
getInstance
Obtains an individual instance.- Parameters:
u
- the origin user.v
- the destination user.- Returns:
- the instance if it exists, null otherwise
-
getInstancesWithOrigin
Gets the set of instances which have a user as origin of the edge.- Parameters:
u
- the origin of the edge.- Returns:
- a map containing the instances which have u as origin user.
-
getInstancesWithDest
Gets the set of instances which have a user as destination of the edge.- Parameters:
v
- the destination of the edge.- Returns:
- a map containing the instances which have v as destination user.
-
getInstanceMap
Obtains a relationship between pairs of users and instances.- Returns:
- the relationship between pairs of users and instances.
-