Sha256: 59974841a07b4e9bfa9f54b87c340062de3aa936caa977417e48717e21b4fc74

Contents?: true

Size: 1.38 KB

Versions: 54

Compression:

Stored size: 1.38 KB

Contents

# == Schema Information
#
# Table name: easy_ml_model_histories
#
#  id                 :bigint           not null, primary key
#  model_id           :integer          not null
#  name               :string           not null
#  model_type         :string
#  status             :string
#  dataset_id         :integer
#  model_file_id      :integer
#  configuration      :json
#  version            :string           not null
#  root_dir           :string
#  file               :json
#  sha                :string
#  last_trained_at    :datetime
#  is_training        :boolean
#  created_at         :datetime         not null
#  updated_at         :datetime         not null
#  history_started_at :datetime         not null
#  history_ended_at   :datetime
#  history_user_id    :integer
#  snapshot_id        :string
#
module EasyML
  class ModelHistory < ActiveRecord::Base
    self.table_name = "easy_ml_model_histories"
    include Historiographer::History

    scope :deployed, -> {
        where(id: EasyML::Deploy.latest.includes(:model_version).map(&:model_version).compact.map(&:id))
      }

    def status
      @status ||= if is_deployed?
          :inference
        else
          :retired
        end
    end

    def is_deployed?
      EasyML::Deploy.latest.where(model_id: model_id)&.first&.model_version&.id == id
    end

    def fit
      raise "Cannot train inference model"
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
easy_ml-0.2.0.pre.rc57 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc56 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc55 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc52 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc51 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc50 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc49 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc48 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc47 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc46 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc45 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc44 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc43 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc41 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc40 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc39 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc38 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc37 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc36 app/models/easy_ml/model_history.rb
easy_ml-0.2.0.pre.rc35 app/models/easy_ml/model_history.rb