Skip to content
This repository was archived by the owner on Nov 16, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#The maximum time to wait for Scala Futures to complete.
awaitSeconds=600

_DEBUG=True
_DEBUG=False

#Basically forward declarations.
_typeToCommonClass = None
Expand Down
76 changes: 60 additions & 16 deletions caffe-grid/src/main/python/examples/DLDemo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,11 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Traceback (most recent call last):\n",
" File \"/tmp/spark-9d1b688e-21a9-4f2c-b235-67dc6b9dd524/userFiles-1b64f242-e09b-4419-8821-487188b91c88/caffeonsparkapi.zip/ConversionUtil.py\", line 617, in callJavaMethod\n",
" return javaInstance(*_getConvertedTuple(args,sym,defaults,mirror))\n",
" File \"/tmp/spark-9d1b688e-21a9-4f2c-b235-67dc6b9dd524/userFiles-1b64f242-e09b-4419-8821-487188b91c88/caffeonsparkapi.zip/ConversionUtil.py\", line 604, in _getConvertedTuple\n",
" convertedList.append(defaults[-argDifference+i])\n",
"IndexError: list index out of range\n"
]
}
],
"outputs": [],
"source": [
"cfg=Config(sc)\n",
"cfg.protoFile='lenet_dataframe_solver.prototxt'\n",
Expand Down Expand Up @@ -514,14 +501,71 @@
"g.toPandas()[:10]"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"### Logistic Regression using MLlib"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
"source": [
"from pyspark.mllib.linalg import Vectors\n",
"from pyspark.mllib.regression import LabeledPoint\n",
"from pyspark.mllib.classification import LogisticRegressionWithLBFGS"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"data = f.map(lambda row: LabeledPoint(row.label[0], Vectors.dense(row.ip1)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"lr = LogisticRegressionWithLBFGS.train(data, numClasses=10, iterations=10)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"predictions = lr.predict(data.map(lambda pt : pt.features))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"predictions.take(5)"
]
}
],
"metadata": {
Expand Down
Loading