-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmodify_data.cpp
47 lines (40 loc) · 866 Bytes
/
modify_data.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ifstream IF;
ofstream OF;
IF.open("input.txt");
OF.open("dataset_movielens_items.py");
int cur,prev,mov,i;
long long int tmp;
float rating=-1;
prev=-1;
OF<<"dataset={";
// OF<<"\t\t"<<cur<<" :{ ";
i=0;
while(i<855599)
{
IF>>cur>>mov>>rating;
//OF<<" "<<mov<<" "<<rating;
if(i==0)
OF<<"\t\t\'"<<cur<<"\' :{ ";
if(i>0)
{OF<<"\'"<<mov<<"\': "<<rating;}
if(cur==prev)
{
OF<<",\n\t\t\t\t";
}
else if(i>0)
{
OF<<"},\n\t\t\'"<<cur<<"\' :{ ";
}
// IF>>mov>>rating>>tmp;
// IF>>mov>>rating>>tmp;
prev=cur;
i++;
}
OF<<"}\n};";
return 0;
}