Skip to content

Commit 71ee943

Browse files
committed
Merge pull request yahoo#50 from mriduljain/ipython_caffeonsparkapis
Disable debug in conversion utils py
2 parents 108d457 + 6fc0664 commit 71ee943

3 files changed

Lines changed: 61 additions & 565 deletions

File tree

‎caffe-grid/src/main/python/com/yahoo/ml/caffe/ConversionUtil.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#The maximum time to wait for Scala Futures to complete.
6666
awaitSeconds=600
6767

68-
_DEBUG=True
68+
_DEBUG=False
6969

7070
#Basically forward declarations.
7171
_typeToCommonClass = None

‎caffe-grid/src/main/python/examples/DLDemo.ipynb‎

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,11 @@
155155
},
156156
{
157157
"cell_type": "code",
158-
"execution_count": 7,
158+
"execution_count": null,
159159
"metadata": {
160160
"collapsed": false
161161
},
162-
"outputs": [
163-
{
164-
"name": "stderr",
165-
"output_type": "stream",
166-
"text": [
167-
"Traceback (most recent call last):\n",
168-
" File \"/tmp/spark-9d1b688e-21a9-4f2c-b235-67dc6b9dd524/userFiles-1b64f242-e09b-4419-8821-487188b91c88/caffeonsparkapi.zip/ConversionUtil.py\", line 617, in callJavaMethod\n",
169-
" return javaInstance(*_getConvertedTuple(args,sym,defaults,mirror))\n",
170-
" File \"/tmp/spark-9d1b688e-21a9-4f2c-b235-67dc6b9dd524/userFiles-1b64f242-e09b-4419-8821-487188b91c88/caffeonsparkapi.zip/ConversionUtil.py\", line 604, in _getConvertedTuple\n",
171-
" convertedList.append(defaults[-argDifference+i])\n",
172-
"IndexError: list index out of range\n"
173-
]
174-
}
175-
],
162+
"outputs": [],
176163
"source": [
177164
"cfg=Config(sc)\n",
178165
"cfg.protoFile='lenet_dataframe_solver.prototxt'\n",
@@ -514,14 +501,71 @@
514501
"g.toPandas()[:10]"
515502
]
516503
},
504+
{
505+
"cell_type": "markdown",
506+
"metadata": {
507+
"collapsed": true
508+
},
509+
"source": [
510+
"### Logistic Regression using MLlib"
511+
]
512+
},
517513
{
518514
"cell_type": "code",
519515
"execution_count": null,
520516
"metadata": {
521517
"collapsed": true
522518
},
523519
"outputs": [],
524-
"source": []
520+
"source": [
521+
"from pyspark.mllib.linalg import Vectors\n",
522+
"from pyspark.mllib.regression import LabeledPoint\n",
523+
"from pyspark.mllib.classification import LogisticRegressionWithLBFGS"
524+
]
525+
},
526+
{
527+
"cell_type": "code",
528+
"execution_count": null,
529+
"metadata": {
530+
"collapsed": true
531+
},
532+
"outputs": [],
533+
"source": [
534+
"data = f.map(lambda row: LabeledPoint(row.label[0], Vectors.dense(row.ip1)))"
535+
]
536+
},
537+
{
538+
"cell_type": "code",
539+
"execution_count": null,
540+
"metadata": {
541+
"collapsed": true
542+
},
543+
"outputs": [],
544+
"source": [
545+
"lr = LogisticRegressionWithLBFGS.train(data, numClasses=10, iterations=10)"
546+
]
547+
},
548+
{
549+
"cell_type": "code",
550+
"execution_count": null,
551+
"metadata": {
552+
"collapsed": true
553+
},
554+
"outputs": [],
555+
"source": [
556+
"predictions = lr.predict(data.map(lambda pt : pt.features))"
557+
]
558+
},
559+
{
560+
"cell_type": "code",
561+
"execution_count": null,
562+
"metadata": {
563+
"collapsed": true
564+
},
565+
"outputs": [],
566+
"source": [
567+
"predictions.take(5)"
568+
]
525569
}
526570
],
527571
"metadata": {

0 commit comments

Comments
 (0)