Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ml/predict produces extra column #15

Open
behrica opened this issue Aug 4, 2024 · 4 comments
Open

ml/predict produces extra column #15

behrica opened this issue Aug 4, 2024 · 4 comments

Comments

@behrica
Copy link
Member

behrica commented Aug 4, 2024

(ns scicloj.metamorph.type-test
  (:require [tablecloth.api :as tc]
            [scicloj.metamorph.ml :as ml]
            [tech.v3.dataset.modelling :as ds-mod]
            [tech.v3.dataset.categorical :as ds-cat]
            [tech.v3.dataset :as ds]))

(require '[scicloj.ml.smile.classification])
(def trained-model 
  (->
   (tc/dataset {:x1 [1 2 4 5 6 5 6 7]
                :x2 [5 6 6 7 8 2 4 6]
                :y [ :a :b :b :a :a :a :b :b]})
   (ds/categorical->number [:y])
   (ds-mod/set-inference-target :y)
   (ml/train {:model-type :smile.classification/knn})
   )
    )
(->
 (ml/predict (tc/dataset {:x1 [1 2 3]
                          :x2 [5 6 7]}) trained-model)
 (ds-cat/reverse-map-categorical-xforms))

produces

:_unnamed [3 4]:

|         :a |         :b |   2 | :y |
|-----------:|-----------:|----:|----|
| 0.33333333 | 0.66666667 | 0.0 | :b |
| 0.33333333 | 0.66666667 | 0.0 | :b |
| 0.33333333 | 0.66666667 | 0.0 | :b |

But column "2" should not be there.
Seems a regression to me.

@behrica
Copy link
Member Author

behrica commented Aug 4, 2024

"2" seems to be the number of labels, it changes when more labels are possible

@behrica
Copy link
Member Author

behrica commented Aug 4, 2024

Its probbaly an issue of , scicloj.ml.smile, to be confirmed

@behrica behrica transferred this issue from scicloj/metamorph.ml Aug 4, 2024
@behrica
Copy link
Member Author

behrica commented Aug 4, 2024

introduced by this commit:
1895016

@behrica
Copy link
Member Author

behrica commented Aug 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant