<file_sep>package com.assignment2.Dataconvert;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class BookDataConvert {

	/**
	 * cat u.data | cut -f1,2,3 | tr "\\t" ","
	 * @throws IOException 
	 * 
	 */
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new FileReader("data/BX-Book-Ratings.csv"));
		BufferedWriter bw = new BufferedWriter(new FileWriter("data/books1.csv"));
		
		String line;
		
		while((line = br.readLine()) != null) {
			String withoutQuotes_line1 = line.replaceAll("\"", "");
			String[] values = withoutQuotes_line1.split(";", -1);
			try{
			bw.write(Long.parseLong(values[0]) + "," + Long.parseLong(values[1]) + "," + Long.parseLong(values[2]) + "\n");
			}catch(Exception e){
				continue;
			}
		}
		
		br.close();
		bw.close();

	}

}<file_sep># Recommendation-System-using-ApacheMahout

Collaborative Filtering Using Mahout Library. 

Data Sets Used: 

1. 100k Movie Lens Dataset.
	URL : http://grouplens.org/datasets/movielens/100k/ 

2. Book Crossing Dataset.
	URL: http://www2.informatik.uni-freiburg.de/~cziegler/BX/   

Data preprocessing: 

Movie Lens Dataset: 
The dataset has values separated by '\t' and also timestamps are reported. Since mahout based recommendation systems do not take time into account, I had to drop that field. Further I processed every row, to convert the delimiter from '\t' to ',', which is the delimited expected by Mahout. 

Book Crossing Dataset:
The dataset had values reported in form of strings, with every field enclosed as double quotes and with ';' as the delimiter. I preprocessed the dataset to change the delimiter and also change the delimiter to ','. Further strings were converted to long integers for compatibility with Apache Mahout I/p format.

Platform Used :  
Eclipse, Java 1.8 
