In [ ]:
#
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
In [ ]:
import sparktk
import tap_catalog
from sparktk import TkContext
from tap_catalog import DataCatalog
print "SparkTK installation path = %s" % (sparktk.__path__)
tc = TkContext()
In [ ]:
ds = "hdfs://nameservice1/org/29ace093-e11f-4f0b-b254-3f8e973476e5/brokers/userspace/694b3da9-c21a-4063-bf16-e072ac47f881/30fc50da-f065-41d8-a510-77d0b7683a47/000000_1"
sc = [("label", float), ("feature1", float), ("feature2", float), ("feature3", float), ("feature4", float),
("feature5", float), ("feature6", float), ("feature7", float), ("feature8", float), ("feature9", float)]
frame = tc.frame.import_csv(ds,schema=sc)
frame.inspect()
In [ ]:
m = tc.models.classification.svm.train(frame,
["feature1", "feature2", "feature3", "feature4", "feature5", "feature6", "feature7", "feature8", "feature9"],
label_column='label')
In [ ]:
m.export_to_mar("hdfs://nameservice1/user/vcap/spaceshuttleSVMmodel.mar")
In [ ]:
data_catalog = DataCatalog()
In [ ]:
data_catalog.add("hdfs://nameservice1/user/vcap/spaceshuttleSVMmodel.mar")
In [ ]:
import hdfsclient
In [ ]:
hdfsclient.ls('/user/vcap/*.mar')
In [ ]:
#hdfsclient.rm('spaceshuttleSVMmodel.mar')
In [ ]: