14.1 of LP3 edits
This commit is contained in:
parent
1e2af7d33c
commit
baa5d425bf
@ -28,7 +28,8 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Problem 14.1"
|
"# Problem 14.1\n",
|
||||||
|
"This is a good approach for exploring associative relationships between customers. Since there is company data mixed with demographic data, the association rules can yield better results and demonstrate better associations since purchases can be examined with respect to age, location, number of dependents, and any other demographic data available."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -71,9 +72,9 @@
|
|||||||
"courses_df = pd.read_csv('Coursetopics.csv')\n",
|
"courses_df = pd.read_csv('Coursetopics.csv')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"reader = Reader(rating_scale=(0, 1))\n",
|
"reader = Reader(rating_scale=(0, 1))\n",
|
||||||
"data = Dataset.load_from_df(ratings[['customerID', 'movieID', 'rating']], reader)\n",
|
"data = Dataset.load_from_df(courses_df['customerID', 'movieID', 'rating']], reader)\n",
|
||||||
"trainset = data.build_full_trainset()\n",
|
"trainset = data.build_full_trainset()\n",
|
||||||
"sim_options = {'name': 'cosine', 'user_based': False} # compute cosine similarities between items\n",
|
"sim_options = {'name': 'cosine', 'user_based': True} # compute cosine similarities between items\n",
|
||||||
"algo = KNNBasic(sim_options=sim_options)\n",
|
"algo = KNNBasic(sim_options=sim_options)\n",
|
||||||
"algo.fit(trainset)\n",
|
"algo.fit(trainset)\n",
|
||||||
"pred = algo.predict(str(823519), str(30), r_ui=4, verbose=True)"
|
"pred = algo.predict(str(823519), str(30), r_ui=4, verbose=True)"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user