Class BOBW

java.lang.Object
  extended by COM.hugin.HAPI.Domain
      extended by BOBW
All Implemented Interfaces:
COM.hugin.HAPI.ParseListener

public class BOBW
extends COM.hugin.HAPI.Domain
implements COM.hugin.HAPI.ParseListener

Class for setting up and running a BOBW network, with or without additional content features

Author:
Cecilie Bøe

Nested Class Summary
 
Nested classes/interfaces inherited from class COM.hugin.HAPI.Domain
COM.hugin.HAPI.Domain.Category, COM.hugin.HAPI.Domain.Constraint, COM.hugin.HAPI.Domain.Endian, COM.hugin.HAPI.Domain.Equilibrium, COM.hugin.HAPI.Domain.EvidenceMode, COM.hugin.HAPI.Domain.Kind, COM.hugin.HAPI.Domain.TriangulationMethod
 
Field Summary
 
Fields inherited from class COM.hugin.HAPI.Domain
H_CATEGORY_CHANCE, H_CATEGORY_DECISION, H_CATEGORY_ERROR, H_CATEGORY_UTILITY, H_CONSTRAINT_BACKWARD_EDGE_FORBIDDEN, H_CONSTRAINT_BACKWARD_EDGE_REQUIRED, H_CONSTRAINT_EDGE_FORBIDDEN, H_CONSTRAINT_EDGE_REQUIRED, H_CONSTRAINT_ERROR, H_CONSTRAINT_FORWARD_EDGE_FORBIDDEN, H_CONSTRAINT_FORWARD_EDGE_REQUIRED, H_CONSTRAINT_NONE, H_ENDIAN_BIG, H_ENDIAN_HOST, H_ENDIAN_LITTLE, H_EQUILIBRIUM_MAX, H_EQUILIBRIUM_SUM, H_EVIDENCE_MODE_FAST_RETRACTION, H_EVIDENCE_MODE_NORMAL, H_KIND_CONTINUOUS, H_KIND_DISCRETE, H_KIND_ERROR, H_TM_CLIQUE_SIZE, H_TM_CLIQUE_WEIGHT, H_TM_FILL_IN_SIZE, H_TM_FILL_IN_WEIGHT, H_TM_TOTAL_WEIGHT
 
Constructor Summary
BOBW(String modelType, String trainingSet, int numberOfTrainingCases, String testSet, int numberOfTestCases, int numberOfUsers, int numberOfMovies, int comCatStates)
          Constructs a new network with a user, community, movie, category and rating node, where the four first are LabelledDCNodes and the last is a ContinuousChanceNode Sets the ratings to unnormalized by default.
 
Method Summary
 void parseError(int position, String msg)
          Method inherited from ParseListener, handles errors regarding the parsing of the data cases in Hugin
 double[] runExternal()
          The method called to set up the network with the chosen parameters, train it with the given training set, and test it with respect to the given test set
 void setNormalized(boolean norm)
          Sets the ratings to normalized or unnormalized (they are unnormalized per default)
 void setNumberOfIterations(int upperNetwork, int ratingNode, int rounds)
          Sets the number of EM iterations to be used for the learning of the model (if other than the default is wanted)
 
Methods inherited from class COM.hugin.HAPI.Domain
approximate, compile, compress, delete, INFINITY, isCompiled, JPA100, JPA101, JPA102, JPA103, JPA104, JPA21, JPA47, JPA48, JPA49, JPA50, JPA51, JPA52, JPA53, JPA54, JPA55, JPA56, JPA57, JPA58, JPA59, JPA60, JPA61, JPA62, JPA63, JPA64, JPA65, JPA66, JPA67, JPA68, JPA69, JPA70, JPA71, JPA72, JPA73, JPA74, JPA75, JPA76, JPA77, JPA78, JPA79, JPA80, JPA81, JPA82, JPA83, JPA84, JPA85, JPA86, JPA87, JPA88, JPA89, JPA90, JPA91, JPA92, JPA93, JPA94, JPA95, JPA96, JPA97, JPA98, JPA99, propagate, save, simulate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BOBW

public BOBW(String modelType,
            String trainingSet,
            int numberOfTrainingCases,
            String testSet,
            int numberOfTestCases,
            int numberOfUsers,
            int numberOfMovies,
            int comCatStates)
     throws COM.hugin.HAPI.ExceptionHugin
Constructs a new network with a user, community, movie, category and rating node, where the four first are LabelledDCNodes and the last is a ContinuousChanceNode Sets the ratings to unnormalized by default. This can be changed to normalized by calling the setNormalized()-method Sets the number of EM iterations to one round of ten non-continuous learning iterations and one one continuous learning iteration by default. This can be changed to the desired combination by calling the setNumberOfIterations()-method

Parameters:
modelType - The model type is "plain" if no additional features are to be included in the network, "year" to include movie release year, "dir&act" to include directors and actors, "zip" to include user zip codes, and "age" to include user age
trainingSet - The path to the training set file
numberOfTrainingCases - The number of data cases in the training set
testSet - The path to the test set file
numberOfTestCases - The number of data cases in the test set
comCatStates - The number of states which is wanted in the two latent nodes Community and Category
Throws:
COM.hugin.HAPI.ExceptionHugin
Method Detail

setNumberOfIterations

public void setNumberOfIterations(int upperNetwork,
                                  int ratingNode,
                                  int rounds)
Sets the number of EM iterations to be used for the learning of the model (if other than the default is wanted)

Parameters:
upperNetwork - The number of EM iterations on the non-continuous nodes for each round
ratingNode - The number of EM iterations on the continuous node for each round
rounds - the number of times the iterations on the non-continuous and continuous nodes are to be repeated

setNormalized

public void setNormalized(boolean norm)
Sets the ratings to normalized or unnormalized (they are unnormalized per default)

Parameters:
norm - true if you want normalized ratings, false otherwise

runExternal

public double[] runExternal()
The method called to set up the network with the chosen parameters, train it with the given training set, and test it with respect to the given test set

Returns:
returns a double-array where the first entry is the MAE, and the second is the RMSE

parseError

public void parseError(int position,
                       String msg)
Method inherited from ParseListener, handles errors regarding the parsing of the data cases in Hugin

Specified by:
parseError in interface COM.hugin.HAPI.ParseListener