Source code for synapse.ml.vw.VowpalWabbitContextualBanditModel

# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in project root for information.

from synapse.ml.vw._VowpalWabbitContextualBanditModel import (
    _VowpalWabbitContextualBanditModel,
)
from pyspark.ml.common import inherit_doc
from pyspark import SparkContext, SQLContext
from pyspark.sql import DataFrame


[docs]@inherit_doc class VowpalWabbitContextualBanditModel(_VowpalWabbitContextualBanditModel):
[docs] def saveNativeModel(self, filename): """ Save the native model to a local or WASB remote location. """ self._java_obj.saveNativeModel(filename)
[docs] def getNativeModel(self): """ Get the binary native VW model. """ return self._java_obj.getModel()
[docs] def getReadableModel(self): return self._java_obj.getReadableModel()
[docs] def getPerformanceStatistics(self): ctx = SparkContext._active_spark_context sql_ctx = SQLContext.getOrCreate(ctx) return DataFrame(self._java_obj.getPerformanceStatistics(), sql_ctx)