Skip to content

Commit

Permalink
more metrices for glance
Browse files Browse the repository at this point in the history
  • Loading branch information
behrica committed Apr 28, 2024
1 parent bfde340 commit 0b52aec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ConstantChangeLog

- more OLS metrices in glance

# 7.4.1
- added misisng files

Expand Down
11 changes: 7 additions & 4 deletions src/scicloj/ml/smile/models/ols.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
:logLik (ml/loglik model y y_hat)
:bic (metrics/BIC model y y_hat sample-size (count (:feature-columns model)))
:aic (metrics/AIC model y y_hat (count (:feature-columns model)))
:p-value (.pvalue ols)}))
:p-value (.pvalue ols)
:rss (.RSS ols)
:rmse (stats/rmse y y_hat)
:mse (stats/mse y y_hat)}))

(defn predict [thawed-model ds]
(let [ds-with-bias
Expand Down Expand Up @@ -136,7 +139,7 @@
standard-metrics-map (standard-metric-maps m)]
(assoc standard-metrics-map

:rss (.RSS ols)

:coefficients (seq (.coefficients ols))
:intercept (.intercept ols)
:residuals (seq (.residuals ols))
Expand All @@ -145,8 +148,8 @@
:f-test (.ftest ols)
:error (.error ols)
:t-test (.ttest ols)
:mse (stats/mse y y_hat)
:rmse (stats/rmse y y_hat)


:model m)))


Expand Down
19 changes: 12 additions & 7 deletions test/scicloj/ml/smile/ols_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@

weights (ml/explain ols)]

(is (= [{:r.squared 0.8976335894170215
:adj.r.squared 0.8878844074567379
:df 21
:logLik -134.60792266677416
(is (= [

{:adj.r.squared 0.8878844074567379
:mse 4356.611357123131
:rss 104558.67257095512
:p-value 4.042532223561903E-11
:df 21, :aic 277.2158453335483
:bic 281.9280606549401
:aic 277.2158453335483
:p-value 4.042532223561903E-11}]
:rmse 66.00463133086292
:r.squared 0.8976335894170215
:logLik -134.60792266677416}]

(ds/rows
(ml/glance ols))))

Expand Down Expand Up @@ -72,7 +77,7 @@
(is (= [5 4]
(ds/shape
(ml/tidy ols))))
(is (= [7 1]
(is (= [10 1]
(ds/shape
(ml/glance ols))))
(is (= [7 150]
Expand Down

0 comments on commit 0b52aec

Please sign in to comment.