Class: PythonModel

Inherits:
ScoutModel show all
Defined in:
lib/scout/model/python/base.rb

Direct Known Subclasses

TorchModel

Instance Attribute Summary

Attributes inherited from ScoutModel

#directory, #options, #state

Instance Method Summary collapse

Methods inherited from ScoutModel

#add, #add_list, #eval, #eval_list, #execute, #extract_features, #extract_features_list, #init, #load_method, #load_options, #load_ruby_code, #load_state, #post_process, #post_process_list, #restore, #save, #save_method, #save_options, #save_state, #state_file, #train

Constructor Details

#initialize(dir, python_class = nil, python_module = nil, options = nil) ⇒ PythonModel

Returns a new instance of PythonModel.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/scout/model/python/base.rb', line 5

def initialize(dir, python_class = nil, python_module = nil, options = nil)
  options, python_module = python_module, :model if options.nil? && Hash === python_module
  options = {} if options.nil?

  options[:python_class] = python_class if python_class
  options[:python_module] = python_module if python_module

  super(dir, options)

  if options[:python_class]
    self.init do
      ScoutPython.add_path Scout.python.find(:lib)
      ScoutPython.add_path directory
      ScoutPython.init_scout
      ScoutPython.class_new_obj(options[:python_module],
                                options[:python_class],
                                **options.except(:python_class, :python_module))
    end
  end
end