Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
trajanov committed Feb 21, 2024
1 parent ae07a8e commit d4385b0
Show file tree
Hide file tree
Showing 5 changed files with 417 additions and 389 deletions.
48 changes: 20 additions & 28 deletions Notebooks/Spark-Example-19-Logistic-Regression.ipynb

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions Notebooks/Spark-Example-20b-Imbalanced-Classes.ipynb

Large diffs are not rendered by default.

123 changes: 30 additions & 93 deletions Notebooks/Spark-Example-22-Mllib-Clustering.ipynb

Large diffs are not rendered by default.

73 changes: 41 additions & 32 deletions Notebooks/Spark-Example-22a-Mllib-Recomender.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -88,7 +88,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -105,9 +105,18 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Spark\\spark-3.2.2-bin-hadoop3.2\\python\\pyspark\\sql\\context.py:125: FutureWarning: Deprecated in 3.0.0. Use SparkSession.builder.getOrCreate() instead.\n",
" warnings.warn(\n"
]
}
],
"source": [
"# Create an ALS model\n",
"als = ALS(maxIter=10, regParam=0.01, userCol=\"userId\", itemCol=\"movieId\", \n",
Expand All @@ -128,14 +137,14 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Root-mean-square error = 1.1084889040192045\n"
"Root-mean-square error = 1.1165104135074504\n"
]
}
],
Expand All @@ -151,7 +160,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -194,20 +203,20 @@
"+----------------------------------------------------+-----------------------------------------------+------+\n",
"\n",
"Top 10 recommendations for user with id 2\n",
"+------------------------------------------+----------------------+---------+\n",
"|title |genres |rating |\n",
"+------------------------------------------+----------------------+---------+\n",
"|Melancholia (2011) |Drama|Sci-Fi |7.194734 |\n",
"|I Now Pronounce You Chuck and Larry (2007)|Comedy|Romance |7.02486 |\n",
"|Presumed Innocent (1990) |Crime|Drama|Thriller |6.7362227|\n",
"|Inland Empire (2006) |Drama|Mystery|Thriller|6.6720815|\n",
"|Wet Hot American Summer (2001) |Comedy |6.627207 |\n",
"|Ted (2012) |Comedy|Fantasy |6.38904 |\n",
"|Big Hit, The (1998) |Action|Comedy|Crime |6.366472 |\n",
"|Goods: Live Hard, Sell Hard, The (2009) |Comedy |6.3511667|\n",
"|U.S. Marshals (1998) |Action|Crime|Thriller |6.350479 |\n",
"|Johnny English (2003) |Action|Comedy|Thriller|6.30307 |\n",
"+------------------------------------------+----------------------+---------+\n",
"+----------------------------------------------+--------------------------------------------------+---------+\n",
"|title |genres |rating |\n",
"+----------------------------------------------+--------------------------------------------------+---------+\n",
"|Home (2015) |Adventure|Animation|Children|Comedy|Fantasy|Sci-Fi|7.6710367|\n",
"|P.S. I Love You (2007) |Comedy|Drama|Romance |7.432799 |\n",
"|Midnight in the Garden of Good and Evil (1997)|Crime|Drama|Mystery |7.13212 |\n",
"|One Crazy Summer (1986) |Comedy |7.0771427|\n",
"|Ready to Rumble (2000) |Comedy |7.006646 |\n",
"|Accepted (2006) |Comedy |6.941869 |\n",
"|Winnie the Pooh and the Blustery Day (1968) |Animation|Children|Musical |6.94146 |\n",
"|Minions (2015) |Adventure|Animation|Children|Comedy |6.838095 |\n",
"|Lost Boys, The (1987) |Comedy|Horror|Thriller |6.8316426|\n",
"|'burbs, The (1989) |Comedy |6.8068523|\n",
"+----------------------------------------------+--------------------------------------------------+---------+\n",
"\n"
]
}
Expand All @@ -234,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -245,16 +254,16 @@
"+-------+------+---------+\n",
"|movieId|userId|rating |\n",
"+-------+------+---------+\n",
"|2 |557 |5.914295 |\n",
"|2 |364 |5.5464435|\n",
"|2 |498 |5.3732324|\n",
"|2 |485 |5.332339 |\n",
"|2 |538 |5.2119656|\n",
"|2 |344 |5.205458 |\n",
"|2 |584 |5.1301875|\n",
"|2 |519 |5.1230307|\n",
"|2 |543 |5.101218 |\n",
"|2 |392 |5.030307 |\n",
"|2 |542 |6.158572 |\n",
"|2 |557 |5.6069818|\n",
"|2 |327 |5.50719 |\n",
"|2 |485 |5.4432106|\n",
"|2 |35 |5.348544 |\n",
"|2 |364 |5.3397155|\n",
"|2 |423 |5.312188 |\n",
"|2 |543 |5.256381 |\n",
"|2 |584 |5.23033 |\n",
"|2 |506 |5.1714926|\n",
"+-------+------+---------+\n",
"\n"
]
Expand Down
Loading

0 comments on commit d4385b0

Please sign in to comment.