Exemplo n.º 1
0
def connect():
    import trustedanalytics as ta
    ta.server.uri = "atk-34157d69-65f4-426f-ac14.demo-gotapaas.com"
    ta.loggers.set_api()
    ta.connect('/root/demo.creds')

    return ta if ta is not None else None
Exemplo n.º 2
0
 def test_create_from_csv(self, patched_be):
     connect()
     f = Frame(CsvFile("dummy.csv", [('A', int32), ('B', int64)]))
     self.assertEqual(0, len(f))
     try:
         c = f['C']
         self.fail()
     except KeyError:
         pass
Exemplo n.º 3
0
def get_simple_frame_abfgh():
    schema = [('A', int32),  ('B', int64), ('F', float32), ('G', float64), ('H', str)]
    f = Frame(CsvFile("dummy.csv", schema))
    connect()
    try:
        del _BaseFrame.schema
    except:
        pass
    setattr(f, "schema", schema)
    return f
Exemplo n.º 4
0
#  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.
#


import unittest
import trustedanalytics as ta

# show full stack traces
ta.errors.show_details = True
ta.loggers.set_api()
# TODO: port setup should move to a super class
if ta.server.port != 19099:
    ta.server.port = 19099
ta.connect()

class ModelNaiveBayesTest(unittest.TestCase):
    def test_naive_bayes(self):
        print "define csv file"
        schema = [("Class", ta.int32),("Dim_1", ta.int32),("Dim_2", ta.int32),("Dim_3",ta.int32)]
        train_file = ta.CsvFile("/datasets/naivebayes_spark_data.csv", schema= schema)
        print "creating the frame"
        train_frame = ta.Frame(train_file)

        print "initializing the naivebayes model"
        n = ta.NaiveBayesModel()

        print "training the model on the frame"
        n.train(train_frame, 'Class', ['Dim_1', 'Dim_2', 'Dim_3'])
Exemplo n.º 5
0
#  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.
#


import unittest
import trustedanalytics as ta

# show full stack traces
ta.errors.show_details = True
ta.server.uri = "atk-c4510a4d-f1ce-44f8-b4a6.10.239.165.216.xip.io"
ta.loggers.set_http()
#ta.loggers.set_api()

ta.connect("/home/yilan/atk/atk_poc/demo.creds")

class ModelNaiveBayesTest(unittest.TestCase):

    def test_naive_bayes(self):
        print "define csv file"

        csv = ta.CsvFile("hdfs://nameservice1/org/intel/hdfsbroker/userspace/ae6a38d3-191f-494f-86a6-3fe1b2255902/e3327582-f475-4dc9-8efa-96070abb606d/000000_1",
                         schema=[
                          ("GXY",ta.int32),
                          #("HPI",ta.ignore),
                          ("Age",ta.int32),
                          ("Sex",ta.int32),
                          ("Height",ta.float64),
                          ("Weight",ta.float64),
                          ("BMI",ta.float64),
Exemplo n.º 6
0
 def test_create(self, patched_be):
     connect()
     f = Frame()
     self.assertEqual(None, f.uri)
Exemplo n.º 7
0
 def test_create(self, patched_be):
     connect()
     f = Frame()
     self.assertEqual(0, f._id)
     self.assertEqual(None, f._error_frame_id)
Exemplo n.º 8
0
 def test_meta(self):
     import trustedanalytics as ta
     ta.connect()
#  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.
#


import unittest
import trustedanalytics as ta

# show full stack traces
ta.errors.show_details = True
ta.server.uri = "ly_test_a-73f30cfd.10.239.165.214.xip.io"
#ta.loggers.set_http()
ta.loggers.set_api()

ta.connect("~/workspace/atktest/demo.creds")

class ModelRandomForestTest(unittest.TestCase):

    def testLinearRegression(self):
        print "define csv file"

        csv = ta.CsvFile("hdfs://nameservice1/org/intel/hdfsbroker/userspace/9bb351fa-7b17-4a81-b3b0-521639c1d473/d342214b-c4c0-4963-aeaf-5adf054e22b6/000000_1",
                         schema=[
                          ("GXY",ta.int32),
                          #("HPI",ta.ignore),
                          ("Age",ta.int32),
                          ("Sex",ta.int32),
                          ("Height",ta.float64),
                          ("Weight",ta.float64),
                          ("BMI",ta.float64),
#  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.
#


import unittest
import trustedanalytics as ta

# show full stack traces
ta.errors.show_details = True
ta.server.uri = "atk-bcc31ff0-b3c2-4059-9749.10.239.165.216.xip.io"
#ta.loggers.set_http()
ta.loggers.set_api()

ta.connect("/home/yilan/tap/atk/atkPoc/demo.creds")


class ModelRandomForestTest(unittest.TestCase):

    def testLinearRegression(self):
        print "define csv file"

        csv = ta.CsvFile("hdfs://nameservice1/org/intel/hdfsbroker/userspace/ae6a38d3-191f-494f-86a6-3fe1b2255902/e3327582-f475-4dc9-8efa-96070abb606d/000000_1",
                         schema=[
                          ("GXY",ta.int32),
                          #("HPI",ta.ignore),
                          ("Age",ta.int32),
                          ("Sex",ta.int32),
                          ("Height",ta.float64),
                          ("Weight",ta.float64),
Exemplo n.º 11
0
def connect():
    import trustedanalytics as ta

    ta.connect()

    return ta
Exemplo n.º 12
0
# 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.
#

import unittest
import trustedanalytics as ia

# show full stack traces
ia.errors.show_details = True
ia.loggers.set_api()
# TODO: port setup should move to a super class
if ia.server.port != 19099:
    ia.server.port = 19099
ia.connect()

class ModelRandomForestTest(unittest.TestCase):
    def testSvm(self):
        print "define csv file"
        csv = ia.CsvFile("/datasets/RandomForest.csv", schema= [('Class', int),
                                                               ('Dim_1', ia.float64),
                                                               ('Dim_2',ia.float64)])

        print "create frame"
        frame = ia.Frame(csv)

        print "Initializing the classifier model object"
        classifier = ia.RandomForestClassifierModel()

        print "Training the model on the Frame"
Exemplo n.º 13
0
#-------------------------------------------------------------------------------
# Name:        DataProcess_ATK
# Purpose:
# Author:      xlin1x
# Email:       [email protected]
# Created:     25/1/2016
#-------------------------------------------------------------------------------

# coding: utf-8

# In[10]:

# create connect to server
import trustedanalytics as ta
ta.server.uri='it_flex-e9c6c0af.demo-gotapaas.com'
ta.connect("/root/demo.creds")


# In[11]:

#create an array to maintain frame column
featureList = ["GXY", "Age", "Sex", "Height", "BMI", "DBP", "Cr", "HCT"];
#create an array to maintain classfiy opertion
classfiyList = ["DBP","HCT"];


# In[12]:

#create a schema 
csv = ta.CsvFile("hdfs://nameservice1/org/intel/hdfsbroker/userspace/b61d4808-e761-45c3-bd54-afcb05b84a8b/ef53c275-e12d-49ea-b2dd-bce12717b72b/000000_1",        
                  schema=[
Exemplo n.º 14
0
# 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.
#

import unittest
import trustedanalytics as ta

# show full stack traces
ta.errors.show_details = True
ta.loggers.set_api()
# TODO: port setup should move to a super class
if ta.server.port != 19099:
    ta.server.port = 19099
ta.connect()


class GraphSmokeTest(unittest.TestCase):
    """
    Smoke test basic graph operations to verify functionality that will be needed by all other tests.

    If these tests don't pass, there is no point in running other tests.

    This is a build-time test so it needs to be written to be as fast as possible:
        - Only use the absolutely smallest toy data sets, e.g 20 rows rather than 500 rows
        - Tests are ran in parallel
        - Tests should be short and isolated.
    """
    _multiprocess_can_split_ = True