biolab / orange3-survival-analysis

🍊 :heavy_plus_sign: Survival Analysis add-on for Orange3 data mining suite.
GNU General Public License v3.0
2 stars 4 forks source link

[FIX] owkaplanmeier: cast to a float before fitting the Kaplan-Meier curve. #10

Closed JakaKokosar closed 3 years ago

JakaKokosar commented 3 years ago
Issue

Error occures when this line is called. When dealing with meta attributes values of numpy array are of type 'object' instead of float (see images below).

In [26]: test = np.asarray([1]).squeeze()
In [27]: pd.to_numeric(test)
Out[27]: array(1)
In [28]: test = test.astype(object)
In [29]: pd.to_numeric(test)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-29-04b5b66c3566> in <module>
----> 1 pd.to_numeric(test)
~/.pyenv/versions/3.8.6/envs/orange/lib/python3.8/site-packages/pandas/core/tools/numeric.py in to_numeric(arg, errors, downcast)
    147         coerce_numeric = errors not in ("ignore", "raise")
    148         try:
--> 149             values = lib.maybe_convert_numeric(
    150                 values, set(), coerce_numeric=coerce_numeric
    151             )
pandas/_libs/lib.pyx in pandas._libs.lib.maybe_convert_numeric()
ValueError: Buffer has wrong number of dimensions (expected 1, got 0)

1.)

Screenshot 2021-01-12 at 09 04 03

2.)

Screenshot 2021-01-12 at 09 04 39
Description of changes
Includes
codecov-io commented 3 years ago

Codecov Report

Merging #10 (6d20119) into master (1fe2cd3) will increase coverage by 0.08%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #10      +/-   ##
==========================================
+ Coverage   93.73%   93.82%   +0.08%     
==========================================
  Files           2        2              
  Lines         351      356       +5     
==========================================
+ Hits          329      334       +5     
  Misses         22       22              
Impacted Files Coverage Δ
...contrib/survival_analysis/widgets/owkaplanmeier.py 93.75% <100.00%> (+0.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1fe2cd3...6d20119. Read the comment docs.