In [ ]:
import trustedanalytics as ia

print "ia imported from %s",ia.__file__
ia.loggers.set(level='ERROR', logger_name='meta')
ia.server.uri="spaceshuttle_atk-c23c180d.ontap07.demo-gotapaas.com"
ia.connect(r'Shuttle.creds')

#ia.loggers.set_api()

In [ ]:
drop_objects = True

def drop(pattern):    
    map(atk.drop_frames, filter(lambda x: not x.find(pattern) < 0, atk.get_frame_names()))
    map(atk.drop_graphs, filter(lambda x: not x.find(pattern) < 0, atk.get_graph_names()))
    map(atk.drop_models, filter(lambda x: not x.find(pattern) < 0, atk.get_model_names()))

In [ ]:
ds="hdfs://nameservice1/org/1c0f8db7-eb32-4c5c-b24f-c07511b08268/brokers/userspace/ca7787f2-88aa-400f-a39b-52e5cf3df5ec/83f80b76-3823-4c05-9db4-f30f30efa9c3/000000_1"
sc=[("label",ia.float64),("feature1", ia.float64), ("feature2", ia.float64), ("feature3", ia.float64), ("feature4", ia.float64), ("feature5", ia.float64), ("feature6", ia.float64), ("feature7", ia.float64), ("feature8", ia.float64), ("feature9", ia.float64)]
csv=ia.CsvFile(ds,sc,',',0)
ff2 = ia.Frame(csv)

In [ ]:
print ff2.inspect()
name = 'ShuttleSVMModel'
if name in ia.get_model_names():
    ia.drop_models(name)
SSVMModel = ia.LibsvmModel(name)

SSVMModel.train(ff2, "label", ["feature1", "feature2", "feature3", "feature4", "feature5", "feature6", "feature7", "feature8", "feature9"], epsilon=0.000001, degree=3, gamma=0.11, coef=0.0, nu=0.0001, cache_size=100.0, shrinking=1, probability=0, c=1.0, p=0.1, nr_weight=0)

In [ ]:
print ia.get_model_names()
print ia.get_frame_names()

In [ ]:
SSVMModel = ia.get_model('ShuttleSVMModel')
SSVMModel.publish()

In [ ]:
SSVMModel.test(ff2, "label", ["feature1", "feature2", "feature3", "feature4", "feature5", "feature6", "feature7", "feature8", "feature9"])