Class: PythonModel
- Inherits:
-
VectorModel
- Object
- VectorModel
- PythonModel
- Defined in:
- lib/rbbt/vector/model/python.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#python_class ⇒ Object
Returns the value of attribute python_class.
-
#python_module ⇒ Object
Returns the value of attribute python_module.
Attributes inherited from VectorModel
#balance, #bar, #directory, #eval_model, #extract_features, #factor_levels, #features, #init_model, #labels, #model, #model_options, #model_path, #names, #post_process, #train_model
Instance Method Summary collapse
-
#initialize(dir, python_class = nil, python_module = nil, model_options = nil) ⇒ PythonModel
constructor
A new instance of PythonModel.
Methods inherited from VectorModel
R_eval, R_run, R_train, #__load_method, #add, #add_list, #balance_labels, #clear, #cross_validation, #eval, #eval_list, f1_metrics, #init, #run, #save_models, #train
Constructor Details
#initialize(dir, python_class = nil, python_module = nil, model_options = nil) ⇒ PythonModel
Returns a new instance of PythonModel.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rbbt/vector/model/python.rb', line 9 def initialize(dir, python_class = nil, python_module = nil, = nil) python_module = :model if python_module.nil? , python_module = python_module, :model if .nil? && Hash === python_module = {} if .nil? super(dir, ) @python_class = python_class @python_module = python_module init_model do RbbtPython.add_path @directory RbbtPython.class_new_obj(@python_module, @python_class, **) end if python_class eval_model do |features,list=false| init if list model.eval(features) else model.eval([features])[0] end end end |
Instance Attribute Details
#python_class ⇒ Object
Returns the value of attribute python_class.
8 9 10 |
# File 'lib/rbbt/vector/model/python.rb', line 8 def python_class @python_class end |
#python_module ⇒ Object
Returns the value of attribute python_module.
8 9 10 |
# File 'lib/rbbt/vector/model/python.rb', line 8 def python_module @python_module end |