tangram 0.4.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -30
- data/docs/Tangram.html +5 -4
- data/docs/Tangram/BagOfWordsCosineSimilarityFeatureContribution.html +518 -0
- data/docs/Tangram/BagOfWordsFeatureContribution.html +24 -13
- data/docs/Tangram/Bigram.html +16 -9
- data/docs/Tangram/BinaryClassificationPredictOutput.html +20 -11
- data/docs/Tangram/FeatureContributions.html +20 -11
- data/docs/Tangram/IdentityFeatureContribution.html +20 -11
- data/docs/Tangram/LibTangram.html +3 -2
- data/docs/Tangram/LibTangram/TangramStringView.html +6 -6
- data/docs/Tangram/LoadModelOptions.html +12 -7
- data/docs/Tangram/Model.html +173 -133
- data/docs/Tangram/MulticlassClassificationPredictOutput.html +24 -13
- data/docs/Tangram/NormalizedFeatureContribution.html +20 -11
- data/docs/Tangram/OneHotEncodedFeatureContribution.html +24 -13
- data/docs/Tangram/PredictOptions.html +16 -9
- data/docs/Tangram/RegressionPredictOutput.html +16 -9
- data/docs/Tangram/Unigram.html +12 -7
- data/docs/Tangram/WordEmbeddingFeatureContribution.html +38 -29
- data/docs/_index.html +9 -2
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +16 -37
- data/docs/index.html +16 -37
- data/docs/method_list.html +69 -29
- data/docs/top-level-namespace.html +2 -2
- data/examples/advanced/Gemfile +2 -0
- data/examples/advanced/Gemfile.lock +15 -0
- data/examples/advanced/README.md +14 -0
- data/examples/{heart_disease.tangram → advanced/heart_disease.tangram} +0 -0
- data/examples/{advanced.rb → advanced/main.rb} +1 -1
- data/examples/basic/Gemfile +2 -0
- data/examples/basic/Gemfile.lock +15 -0
- data/examples/basic/README.md +10 -0
- data/examples/basic/heart_disease.tangram +0 -0
- data/examples/{basic.rb → basic/main.rb} +0 -0
- data/lib/tangram/libtangram/aarch64-apple-darwin/libtangram.dylib +0 -0
- data/lib/tangram/libtangram/aarch64-unknown-linux-gnu/libtangram.so +0 -0
- data/lib/tangram/libtangram/aarch64-unknown-linux-musl/libtangram.so +0 -0
- data/lib/tangram/libtangram/x86_64-apple-darwin/libtangram.dylib +0 -0
- data/lib/tangram/libtangram/x86_64-pc-windows-msvc/tangram.dll +0 -0
- data/lib/tangram/libtangram/x86_64-unknown-linux-gnu/libtangram.so +0 -0
- data/lib/tangram/libtangram/x86_64-unknown-linux-musl/libtangram.so +0 -0
- data/lib/tangram/tangram.rb +9 -9
- data/scripts/release +8 -0
- data/tangram.gemspec +4 -4
- metadata +16 -8
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Mon Jul 26 14:54:00 2021 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.26 (ruby-2.
|
105
|
+
0.9.26 (ruby-2.7.4).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Advanced
|
2
|
+
|
3
|
+
This example demonstrates logging predictions and true values to the Tangram app. Before running the example, run `tangram app` to start the app running locally, open `http://localhost:8080` in your browser, and upload the file `heart_disease.tangram` to it.
|
4
|
+
|
5
|
+
To run the example:
|
6
|
+
|
7
|
+
```
|
8
|
+
$ bundle
|
9
|
+
$ TANGRAM_URL=http://localhost:8080 ruby main.rb
|
10
|
+
```
|
11
|
+
|
12
|
+
Now if you refresh the production stats or production metrics tabs for the model you uploaded, you should see predictions and true values.
|
13
|
+
|
14
|
+
For more information, [read the docs](https://www.tangram.dev/docs).
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'tangram'
|
2
2
|
|
3
3
|
# If you are running the Tangram app on your own server you can pass the URL to it with the TANGRAM_URL environment variable.
|
4
|
-
tangram_url = ENV['TANGRAM_URL'] || 'https://app.tangram.
|
4
|
+
tangram_url = ENV['TANGRAM_URL'] || 'https://app.tangram.dev'
|
5
5
|
|
6
6
|
# Get the path to the `.tangram` file.
|
7
7
|
model_path = File.join(File.dirname(__FILE__), 'heart_disease.tangram')
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/tangram/tangram.rb
CHANGED
@@ -9,7 +9,7 @@ module Tangram
|
|
9
9
|
|
10
10
|
# These are the options passed when loading a model.
|
11
11
|
class LoadModelOptions
|
12
|
-
# If you are running the app locally or on your own server, use this field to provide the url to it. If not specified, the default value is https://app.tangram.
|
12
|
+
# If you are running the app locally or on your own server, use this field to provide the url to it. If not specified, the default value is https://app.tangram.dev.
|
13
13
|
attr_reader :tangram_url
|
14
14
|
def initialize(tangram_url:)
|
15
15
|
@tangram_url = tangram_url
|
@@ -255,7 +255,7 @@ module Tangram
|
|
255
255
|
end
|
256
256
|
|
257
257
|
def initialize(c_model, options: nil)
|
258
|
-
@tangram_url = options&.tangram_url.nil? ? 'https://app.tangram.
|
258
|
+
@tangram_url = options&.tangram_url.nil? ? 'https://app.tangram.dev' : options&.tangram_url
|
259
259
|
@log_queue = []
|
260
260
|
@model = FFI::AutoPointer.new(c_model.read_pointer, LibTangram.method(:tangram_model_delete))
|
261
261
|
end
|
@@ -421,7 +421,7 @@ module Tangram
|
|
421
421
|
elsif is_string
|
422
422
|
LibTangram.tangram_predict_input_set_value_string(c_input, key.to_s, value)
|
423
423
|
else
|
424
|
-
raise '
|
424
|
+
raise 'value for key %s is not a float or a string' % key
|
425
425
|
end
|
426
426
|
end
|
427
427
|
c_input
|
@@ -768,18 +768,18 @@ module Tangram
|
|
768
768
|
module LibTangram
|
769
769
|
cpu = RbConfig::CONFIG['host_cpu']
|
770
770
|
os = RbConfig::CONFIG['host_os']
|
771
|
-
if
|
771
|
+
if cpu == 'x86_64' && os =~ /linux/
|
772
772
|
library_path = 'libtangram/x86_64-unknown-linux-gnu/libtangram.so'
|
773
|
-
elsif
|
773
|
+
elsif cpu == 'aarch64' && os =~ /linux/
|
774
774
|
library_path = 'libtangram/aarch64-unknown-linux-gnu/libtangram.so'
|
775
|
-
elsif
|
775
|
+
elsif cpu == 'x86_64' && os =~ /darwin/
|
776
776
|
library_path = 'libtangram/x86_64-apple-darwin/libtangram.dylib'
|
777
|
-
elsif (cpu == '
|
777
|
+
elsif (cpu == 'arm' || cpu == 'arm64') && os =~ /darwin/
|
778
778
|
library_path = 'libtangram/aarch64-apple-darwin/libtangram.dylib'
|
779
|
-
elsif
|
779
|
+
elsif cpu == 'x86_64' && os =~ /mingw/
|
780
780
|
library_path = 'libtangram/x86_64-pc-windows-msvc/tangram.dll'
|
781
781
|
else
|
782
|
-
raise 'Tangram for Ruby does not yet support your combination of CPU architecture and operating system. Open an issue at https://github.com/
|
782
|
+
raise 'Tangram for Ruby does not yet support your combination of CPU architecture and operating system. Open an issue at https://github.com/tangramdotdev/tangram/issues/new or email us at help@tangram.dev to complain.'
|
783
783
|
end
|
784
784
|
extend FFI::Library
|
785
785
|
ffi_lib File.expand_path(library_path.to_s, __dir__)
|
data/scripts/release
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
rm -rf lib/tangram/libtangram/
|
2
|
+
install -D ../../dist/x86_64-unknown-linux-gnu/libtangram.so lib/tangram/libtangram/x86_64-unknown-linux-gnu/libtangram.so
|
3
|
+
install -D ../../dist/aarch64-unknown-linux-gnu/libtangram.so lib/tangram/libtangram/aarch64-unknown-linux-gnu/libtangram.so
|
4
|
+
install -D ../../dist/x86_64-unknown-linux-musl/libtangram.so lib/tangram/libtangram/x86_64-unknown-linux-musl/libtangram.so
|
5
|
+
install -D ../../dist/aarch64-unknown-linux-musl/libtangram.so lib/tangram/libtangram/aarch64-unknown-linux-musl/libtangram.so
|
6
|
+
install -D ../../dist/x86_64-apple-darwin/libtangram.dylib lib/tangram/libtangram/x86_64-apple-darwin/libtangram.dylib
|
7
|
+
install -D ../../dist/aarch64-apple-darwin/libtangram.dylib lib/tangram/libtangram/aarch64-apple-darwin/libtangram.dylib
|
8
|
+
install -D ../../dist/x86_64-pc-windows-msvc/tangram.dll lib/tangram/libtangram/x86_64-pc-windows-msvc/tangram.dll
|
1
9
|
gem build tangram.gemspec
|
2
10
|
rm -rf dist
|
3
11
|
mkdir -p dist
|
data/tangram.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "tangram"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.7.0"
|
4
4
|
s.summary = "Tangram for Ruby"
|
5
|
-
s.description = "Make predictions with a Tangram model from your Ruby app. Learn more at https://www.tangram.
|
5
|
+
s.description = "Make predictions with a Tangram model from your Ruby app. Learn more at https://www.tangram.dev/."
|
6
6
|
s.authors = ["Tangram"]
|
7
|
-
s.email = "help@tangram.
|
7
|
+
s.email = "help@tangram.dev"
|
8
8
|
s.files = Dir["**/**"].grep_v(/.gem$/)
|
9
|
-
s.homepage = "
|
9
|
+
s.homepage = "https://rubygems.org/gems/tangram"
|
10
10
|
s.license = "MIT"
|
11
11
|
s.add_dependency "ffi", "~> 1"
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tangram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tangram
|
@@ -25,8 +25,8 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
27
|
description: Make predictions with a Tangram model from your Ruby app. Learn more
|
28
|
-
at https://www.tangram.
|
29
|
-
email: help@tangram.
|
28
|
+
at https://www.tangram.dev/.
|
29
|
+
email: help@tangram.dev
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- LICENSE
|
37
37
|
- README.md
|
38
38
|
- docs/Tangram.html
|
39
|
+
- docs/Tangram/BagOfWordsCosineSimilarityFeatureContribution.html
|
39
40
|
- docs/Tangram/BagOfWordsFeatureContribution.html
|
40
41
|
- docs/Tangram/Bigram.html
|
41
42
|
- docs/Tangram/BinaryClassificationPredictOutput.html
|
@@ -66,9 +67,16 @@ files:
|
|
66
67
|
- docs/js/jquery.js
|
67
68
|
- docs/method_list.html
|
68
69
|
- docs/top-level-namespace.html
|
69
|
-
- examples/advanced
|
70
|
-
- examples/
|
71
|
-
- examples/
|
70
|
+
- examples/advanced/Gemfile
|
71
|
+
- examples/advanced/Gemfile.lock
|
72
|
+
- examples/advanced/README.md
|
73
|
+
- examples/advanced/heart_disease.tangram
|
74
|
+
- examples/advanced/main.rb
|
75
|
+
- examples/basic/Gemfile
|
76
|
+
- examples/basic/Gemfile.lock
|
77
|
+
- examples/basic/README.md
|
78
|
+
- examples/basic/heart_disease.tangram
|
79
|
+
- examples/basic/main.rb
|
72
80
|
- lib/tangram.rb
|
73
81
|
- lib/tangram/libtangram/aarch64-apple-darwin/libtangram.dylib
|
74
82
|
- lib/tangram/libtangram/aarch64-unknown-linux-gnu/libtangram.so
|
@@ -83,7 +91,7 @@ files:
|
|
83
91
|
- scripts/fmt
|
84
92
|
- scripts/release
|
85
93
|
- tangram.gemspec
|
86
|
-
homepage:
|
94
|
+
homepage: https://rubygems.org/gems/tangram
|
87
95
|
licenses:
|
88
96
|
- MIT
|
89
97
|
metadata: {}
|
@@ -102,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
110
|
- !ruby/object:Gem::Version
|
103
111
|
version: '0'
|
104
112
|
requirements: []
|
105
|
-
rubygems_version: 3.2.
|
113
|
+
rubygems_version: 3.2.24
|
106
114
|
signing_key:
|
107
115
|
specification_version: 4
|
108
116
|
summary: Tangram for Ruby
|