Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

JsonParseException error when using forest_predict - forum topic by adamm313

$
0
0

Hello,
 
I'm trying to familiarize myself with the random forest functions that come with Aster by recreating the carprices example used in the Teradata Aster Big Analytics Applicance 3H Analytics User Guide.  I am able to generate a model using forest_drive, but when I try and predict based off of the model, forest_predict returns the following error:
 

ERROR:  SQL-MR function FOREST_PREDICT failed unexpectedly.

 

The following is information that may be useful to the developer of FOREST_PREDICT:

 

com.google.gson.JsonParseException: The JsonDeserializer com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.SplitDeserializer@144aa0ce failed to deserialized json object {"leftCategories_":[1],"rightCategories_":[0],"attr_":"awd","score_":0.34285714285714286,"type_":"CLASSIFICATION_CATEGORICAL_SPLIT","leftNodeSize_":7,"rightNodeSize_":5} given the type class com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.split.ClassificationSplit

        at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:63)

        at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:88)

        at com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:76)

        at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:98)

        at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:73)

        at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:51)

        at com.google.gson.Gson.fromJson(Gson.java:495)

        at com.google.gson.Gson.fromJson(Gson.java:465)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.NodeDeserializer.deserialize(NodeDeserializer.java:94)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.NodeDeserializer.deserialize(NodeDeserializer.java:33)

        at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:50)

        at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:88)

        at com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:76)

        at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:98)

        at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:73)

        at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:51)

        at com.google.gson.Gson.fromJson(Gson.java:495)

        at com.google.gson.Gson.fromJson(Gson.java:465)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.NodeDeserializer.deserialize(NodeDeserializer.java:93)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.NodeDeserializer.deserialize(NodeDeserializer.java:33)

        at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:50)

        at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:88)

        at com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:76)

        at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:98)

        at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:73)

        at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:51)

        at com.google.gson.Gson.fromJson(Gson.java:495)

        at com.google.gson.Gson.fromJson(Gson.java:465)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.TreeSerializer.deserializeClassificationTree(TreeSerializer.java:94)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.TreeSerializer.deserializeTree(TreeSerializer.java:48)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.forest_predict.grabForestFromTable(forest_predict.java:440)

        at com.asterdata.sqlmr.analytics.predictive_modeling.decision_tree.forest.forest_predict.operateOnSomeRows(forest_predict.java:202)

        at com.asterdata.ncluster.sqlmr.internal.SwigRunner.runOperatingOnRows(SwigRunner.java:432)

        at com.asterdata.ncluster.sqlmr.internal.SwigRunner.runOperatingTask(SwigRunner.java:361)

        at com.asterdata.

 

 

Here are the function calls and create table statements that I used (basically what is in the user guide):

 

 

select * from forest_drive(

on (select 1)

partition by 1

userid('db_superuser')

password('db_superuser')

inputTable('tutorial.forest_carprices')

outputTable('tutorial.forest_carprices_model')

treetype('classification')

response('price_class')

numericInputs('cylinders','horsepower','city_mpg','highway_mpg',

'weight','wheelbase','length','width')

categoricalInputs('sports','suv','wagon','minivan','pickup',

'awd','rwd')

maxdepth(4)

minnodesize(5)

variance(0.05)

numTrees(10)

);

 

 

select test_id as car_name, prediction as predicted_class

from forest_predict(

on tutorial.forest_carprices_predict

userid('db_superuser')

password('db_superuser')

forest('tutorial.forest_carprices_model')

numericInputs('cylinders','horsepower','city_mpg','highway_mpg',

'weight','wheelbase','length','width')

categoricalInputs('sports','suv','wagon','minivan','pickup',

'awd','rwd')

idcol('car_name')

);

 

 

CREATE TABLE tutorial.forest_carprices (

car_name varchar(100) NOT NULL,

sports varchar(5) NULL,

suv varchar(5) NULL,

wagon varchar(5) NULL,

minivan varchar(5) NULL,

pickup varchar(5) NULL,

awd varchar(5) NULL,

rwd varchar(5) NULL,

engine integer NULL,

cylinders smallint NULL,

horsepower smallint NULL,

city_mpg smallint NULL,

highway_mpg smallint NULL,

weight integer NULL,

wheelbase smallint NULL,

[length] smallint NULL,

[width] smallint NULL,

retail_price integer NULL,

dealer_price integer NULL,

price_class smallint NULL

)

DISTRIBUTE BY HASH (weight)

STORAGE ROW;

 

 

 

CREATE TABLE tutorial.forest_carprices_predict (

car_name varchar(100) NOT NULL,

sports varchar(5) NULL,

suv varchar(5) NULL,

wagon varchar(5) NULL,

minivan varchar(5) NULL,

pickup varchar(5) NULL,

awd varchar(5) NULL,

rwd varchar(5) NULL,

engine integer NULL,

cylinders smallint NULL,

horsepower smallint NULL,

city_mpg smallint NULL,

highway_mpg smallint NULL,

weight integer NULL,

wheelbase smallint NULL,

[length] smallint NULL,

[width] smallint NULL,

retail_price integer NULL,

dealer_price integer NULL

)

DISTRIBUTE BY HASH (weight)

STORAGE ROW;

 

 

Any insight into what caused this error would be appreciated!

 

Thanks,

 

Adam

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>