Closed bderoy closed 4 years ago
Can you please share the section of the code where you define FeatureBuilder
instances?
@tovbinm Thank you for responding. pls refer to below code snippet.
val stage = FeatureBuilder.Text[opportunity].extract(_.stage.toText).asResponse
val entity = FeatureBuilder.PickList[opportunity].extract(_.entity.map(_.toString).toPickList).asPredictor
val company = FeatureBuilder.Text[opportunity].extract(_.company.toText).asPredictor
val industry = FeatureBuilder.PickList[opportunity].extract(_.industry.map(_.toString).toPickList).asPredictor
val region =FeatureBuilder.PickList[opportunity].extract(_.region.map(_.toString).toPickList).asPredictor
val msp_mme = FeatureBuilder.Text[opportunity].extract(_.msp_mme.toText).asPredictor
val account_type = FeatureBuilder.Text[opportunity].extract(_.account_type.toText).asPredictor
val billing_state = FeatureBuilder.PickList[opportunity].extract(_.billing_state.map(_.toString).toPickList).asPredictor
val billing_country = FeatureBuilder.PickList[opportunity].extract(_.billing_country.map(_.toString).toPickList).asPredictor
val account_customer_status = FeatureBuilder.PickList[opportunity].extract(_.account_customer_status.map(_.toString).toPickList).asPredictor
val opportunity_type = FeatureBuilder.PickList[opportunity].extract(_.opportunity_type.map(_.toString).toPickList).asPredictor
val forecast_category = FeatureBuilder.PickList[opportunity].extract(_.forecast_category.map(_.toString).toPickList).asPredictor
val currency_code = FeatureBuilder.PickList[opportunity].extract(_.currency_code.map(_.toString).toPickList).asPredictor
val close_qtr = FeatureBuilder.Text[opportunity].extract(_.close_qtr.toText).asPredictor
val created_qtr = FeatureBuilder.Text[opportunity].extract(_.created_qtr.toText).asPredictor
val type1 = FeatureBuilder.Text[opportunity].extract(_.type1.toText).asPredictor
val owner_role = FeatureBuilder.Text[opportunity].extract(_.owner_role.toText).asPredictor
Aha, thank you. Now it's clear. You need to create a concrete class for each of the extract functions. For example:
object Extractors {
class StageExtractor extends Function[opportunity, Text] with Serializable {
def apply(o: opportunity): Text = o.stage.toText
}
// define classes for all the other feature extractors
}
import Extractors._
val stage = FeatureBuilder.Text[opportunity].extract(new StageExtractor).asResponse
// and the same for all other feature builders
Here is a full working example for Titanic features - https://github.com/salesforce/TransmogrifAI/blob/master/helloworld/src/main/scala/com/salesforce/hw/titanic/TitanicFeatures.scala#L39
Describe the bug As per documentation https://docs.transmogrif.ai/en/stable/developer-guide/#saving-fitted-workflows when I am trying to save the model then getting runtime exception:
To Reproduce below lines of code
Expected behavior The model should be saved without error in desired location