libffm 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4654201de1d7ca6d66f60cc25deb31aa7dca624387373038ad60081ff298fd0
4
- data.tar.gz: cc97da4ea5faeabce3729f9a126df241c549c699ee49744e67a311fbeaa58125
3
+ metadata.gz: bc1d79899f98f45cbcfab6278aae23893c8304fbe2fae308a842e4ccb14a1d77
4
+ data.tar.gz: d908f0576dc9090db280627a45574547b05ebec82ccc43f15b1fca8e54f86044
5
5
  SHA512:
6
- metadata.gz: f12ceea056e554f7f80370ec353ffe0091889a83b0f1875febe1820abeba8ab15b9d3636526044c6ab3a62fb4fbdfc22e07dd5bd37420a518ef112c23a3f5cd8
7
- data.tar.gz: b345acbb68319e08096c2a078c47afe70b68cb67f0f30020672e903e81a52e195caac52d38b17337cc5c87a152fc27ce03bbcaf2f80e09d568db7de729087ee1
6
+ metadata.gz: ad89c269232bf72ed62dd2a347a6d9cf4129e17240fa2eac843b56cfd02bfd54a5fe7d36420119f7bb4f2f6ff7136fd3a31051ede1a5b6bfea59f6afa3ce771c
7
+ data.tar.gz: 8fbe76a119fe45a5ae8086d99c8c9998aaaa8bd85c81908db9bdf4e340c0754c26014a45be0dc558ccae07d2e21fa3cc5c7b99d75be4e58327d52714acb812f0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.4.1 (2025-10-26)
2
+
3
+ - Fixed error with Rice 4.7
4
+
5
+ ## 0.4.0 (2025-04-03)
6
+
7
+ - Dropped support for Ruby < 3.2
8
+
1
9
  ## 0.3.0 (2023-05-11)
2
10
 
3
11
  - Dropped support for Ruby < 3
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  Copyright (c) 2017 The LIBFFM Project.
3
- Copyright (c) 2020-2023 Andrew Kane.
3
+ Copyright (c) 2020-2025 Andrew Kane.
4
4
  All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [LIBFFM](https://github.com/ycjuan/libffm) - field-aware factorization machines - for Ruby
4
4
 
5
- [![Build Status](https://github.com/ankane/libffm-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/libffm-ruby/actions)
5
+ [![Build Status](https://github.com/ankane/libffm-ruby/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/libffm-ruby/actions)
6
6
 
7
7
  ## Installation
8
8
 
data/ext/libffm/ext.cpp CHANGED
@@ -1,29 +1,19 @@
1
- // stdlib
1
+ #include <cstdio>
2
+ #include <cstdlib>
3
+ #include <cstring>
2
4
  #include <iostream>
5
+ #include <string>
3
6
 
4
- // ffm
5
7
  #include <ffm.h>
6
-
7
- // rice
8
8
  #include <rice/rice.hpp>
9
9
  #include <rice/stl.hpp>
10
10
 
11
- using Rice::Array;
12
- using Rice::Class;
13
- using Rice::Module;
14
- using Rice::Object;
15
- using Rice::String;
16
- using Rice::define_module;
17
- using Rice::define_module_under;
18
- using Rice::define_class_under;
19
-
20
11
  extern "C"
21
- void Init_ext()
22
- {
23
- auto rb_mLibffm = define_module("Libffm");
12
+ void Init_ext() {
13
+ auto rb_mLibffm = Rice::define_module("Libffm");
24
14
 
25
- auto rb_mExt = define_module_under(rb_mLibffm, "Ext");
26
- define_class_under<ffm::ffm_model>(rb_mExt, "Model");
15
+ auto rb_mExt = Rice::define_module_under(rb_mLibffm, "Ext");
16
+ Rice::define_class_under<ffm::ffm_model>(rb_mExt, "Model");
27
17
 
28
18
  rb_mExt
29
19
  .define_singleton_function(
@@ -61,37 +51,37 @@ void Init_ext()
61
51
  [](ffm::ffm_model& model, const std::string& test_path) {
62
52
  int const kMaxLineSize = 1000000;
63
53
 
64
- FILE *f_in = fopen(test_path.c_str(), "r");
54
+ std::FILE *f_in = std::fopen(test_path.c_str(), "r");
65
55
  char line[kMaxLineSize];
66
56
 
67
57
  ffm::vector<ffm::ffm_node> x;
68
58
  ffm::ffm_int i = 0;
69
59
 
70
- Array ret;
71
- for(; fgets(line, kMaxLineSize, f_in) != nullptr; i++) {
60
+ Rice::Array ret;
61
+ for(; std::fgets(line, kMaxLineSize, f_in) != nullptr; i++) {
72
62
  x.clear();
73
- strtok(line, " \t");
63
+ std::strtok(line, " \t");
74
64
 
75
65
  while (true) {
76
- char *field_char = strtok(nullptr,":");
77
- char *idx_char = strtok(nullptr,":");
78
- char *value_char = strtok(nullptr," \t");
66
+ char *field_char = std::strtok(nullptr, ":");
67
+ char *idx_char = std::strtok(nullptr, ":");
68
+ char *value_char = std::strtok(nullptr, " \t");
79
69
  if (field_char == nullptr || *field_char == '\n')
80
70
  break;
81
71
 
82
72
  ffm::ffm_node N;
83
- N.f = atoi(field_char);
84
- N.j = atoi(idx_char);
85
- N.v = atof(value_char);
73
+ N.f = std::atoi(field_char);
74
+ N.j = std::atoi(idx_char);
75
+ N.v = std::atof(value_char);
86
76
 
87
77
  x.push_back(N);
88
78
  }
89
79
 
90
80
  ffm::ffm_float y_bar = ffm::ffm_predict(x.data(), x.data()+x.size(), model);
91
- ret.push(y_bar);
81
+ ret.push(y_bar, false);
92
82
  }
93
83
 
94
- fclose(f_in);
84
+ std::fclose(f_in);
95
85
 
96
86
  return ret;
97
87
  })
@@ -1,3 +1,3 @@
1
1
  module Libffm
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/libffm.rb CHANGED
@@ -5,8 +5,8 @@ require "libffm/ext"
5
5
  require "tmpdir"
6
6
 
7
7
  # modules
8
- require "libffm/model"
9
- require "libffm/version"
8
+ require_relative "libffm/model"
9
+ require_relative "libffm/version"
10
10
 
11
11
  module Libffm
12
12
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libffm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rice
@@ -16,15 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 4.0.2
18
+ version: '4.7'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 4.0.2
27
- description:
25
+ version: '4.7'
28
26
  email: andrew@ankane.org
29
27
  executables: []
30
28
  extensions:
@@ -53,7 +51,6 @@ homepage: https://github.com/ankane/libffm-ruby
53
51
  licenses:
54
52
  - MIT
55
53
  metadata: {}
56
- post_install_message:
57
54
  rdoc_options: []
58
55
  require_paths:
59
56
  - lib
@@ -61,15 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
58
  requirements:
62
59
  - - ">="
63
60
  - !ruby/object:Gem::Version
64
- version: '3'
61
+ version: '3.2'
65
62
  required_rubygems_version: !ruby/object:Gem::Requirement
66
63
  requirements:
67
64
  - - ">="
68
65
  - !ruby/object:Gem::Version
69
66
  version: '0'
70
67
  requirements: []
71
- rubygems_version: 3.4.10
72
- signing_key:
68
+ rubygems_version: 3.6.9
73
69
  specification_version: 4
74
70
  summary: Field-aware factorization machines for Ruby
75
71
  test_files: []