Skip to content

Commit

Permalink
Spec gbm data on correct class
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf schers committed Feb 2, 2018
1 parent d86e580 commit c057d3e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 2 additions & 0 deletions lib/scoruby/models/gradient_boosted_model/data.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Scoruby
module Models
module GradientBoostedModel
Expand Down
24 changes: 24 additions & 0 deletions spec/scoruby/models/gradient_boosted_model/data_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

require 'spec_helper'

describe Scoruby::Models::GradientBoostedModel::Data do
let(:xml) { Scoruby.xml_from_file_path(gbm_file) }
let(:gbm) { described_class.new(xml) }

context 'pmml 4.3' do
let(:gbm_file) { 'spec/fixtures/titanic_gbm.pmml' }

it 'loads correct number of trees' do
expect(gbm.decision_trees.count).to eq 100
end
end

context 'pmml 4.2' do
let(:gbm_file) { 'spec/fixtures/titanic_gbm_4_2.pmml' }

it 'loads correct number of trees' do
expect(gbm.decision_trees.count).to eq 100
end
end
end
10 changes: 1 addition & 9 deletions spec/scoruby/models/gradient_boosted_model/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

context 'pmml 4.3' do
let(:gbm_file) { 'spec/fixtures/titanic_gbm.pmml' }

it 'loads correct number of trees' do
expect(gbm.decision_trees.count).to eq 100
end


it 'predicts approve' do
expect(gbm.score(approve_features)).to eq 0.3652639329522468
end
Expand All @@ -27,10 +23,6 @@
context 'pmml 4.2' do
let(:gbm_file) { 'spec/fixtures/titanic_gbm_4_2.pmml' }

it 'loads correct number of trees' do
expect(gbm.decision_trees.count).to eq 100
end

it 'predicts approve' do
expect(gbm.score(approve_features)).to eq 0.3652639329522468
end
Expand Down

0 comments on commit c057d3e

Please sign in to comment.