Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I tried to test Librec by the code below but it show error Error: Could not find or load main class Please any help to

I tried to test Librec by the code below but it show error "Error: Could not find or load main class"

Please any help to run the code. Thanks

import net.librec.BaseTestCase;

import net.librec.common.LibrecException;

import net.librec.conf.Configuration;

import net.librec.conf.Configuration.Resource;

import net.librec.data.DataModel;

import net.librec.data.model.TextDataModel;

import net.librec.eval.rating.RMSEEvaluator;

import net.librec.filter.GenericRecommendedFilter;

import net.librec.filter.RecommendedFilter;

import net.librec.job.RecommenderJob;

import net.librec.recommender.Recommender;

import net.librec.recommender.RecommenderContext;

import net.librec.recommender.cf.UserKNNRecommender;

import net.librec.recommender.item.RecommendedItem;

import net.librec.similarity.PCCSimilarity;

import net.librec.similarity.RecommenderSimilarity;

import net.librec.util.DriverClassUtil;

import java.awt.List;

import java.io.BufferedWriter;

import java.io.FileWriter;

import org.junit.Before;

import org.junit.FixMethodOrder;

import org.junit.Ignore;

import org.junit.Test;

import org.junit.runners.MethodSorters;

public class test1 {

public void main(String[] args) throws Exception {

System.out.print("lll");

// recommender configuration

Resource resource = new Resource("userknn-test.properties");

Configuration conf = new Configuration();

conf.addResource(resource);

conf.set("dfs.data.dir","E:\\Dropbox\\Dinos-Fwtis\\Thesis\\Code\\Recomendation\\data");

conf.set("dfs.input.path","filmtrust");

conf.set("data.column.format","UIR");

conf.set("data.convert.binarize.threshold","-1.0");

// build data model

TextDataModel dataModel = new TextDataModel(conf);

dataModel.buildDataModel();

System.out.print("OO");

// set recommendation context

RecommenderContext context = new RecommenderContext(conf,dataModel);

RecommenderSimilarity similarity = new PCCSimilarity();

similarity.buildSimilarityMatrix(dataModel);

context.setSimilarity(similarity);

// training

Recommender recommender = new UserKNNRecommender();

recommender.recommend(context);

// evaluation

RMSEEvaluator evaluator = new RMSEEvaluator();

//MAEEvaluator evaluator = new MAEEvaluator();

recommender.evaluate(evaluator);

// recommendation results

java.util.List recommendedItemList = recommender.getRecommendedList();

//List recommendedItemList = recommender.getRecommendedList();

RecommendedFilter filter = new GenericRecommendedFilter();

recommendedItemList = filter.filter(recommendedItemList);

System.out.println("len " + recommendedItemList.size());

BufferedWriter writer = new BufferedWriter(new FileWriter("recommendations.txt"));

for (RecommendedItem recommendedItem : recommendedItemList) {

writer.write(

"user:" + recommendedItem.getUserId() + " " +

"item:" + recommendedItem.getItemId() + " " +

"value:" + recommendedItem.getValue() + " "

);

writer.flush();

}

writer.close();

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions