havakv / havakv/pycox

Discretization error

Open
#44 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
995
Forks
203
PR merge metrics
No merged PRs in 30d

Description

Hi, the following code

```
num_durations = 10
labtrans = MTLR.label_transform(num_durations)
get_target = lambda df: (df['time'].values, df['event'].values)
y_train = labtrans.fit_transform(*get_target(data_train))
y_val = labtrans.transform(*get_target(data_val))
y_test = labtrans.transform(*get_target(data_test))
```

gives me the error:

`TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'`

It is curious that the same code works smoothly before but it no longer works now that I have changed the dataframe features (the columns `time` and `event` have remained the same, without null values, ​​and therefore the problem should not arise).
A suggestion as to what the error might be in such cases would be ideal because I cannot understand what causes it.

Thanks in advance and congratulations on your excellent work.

EDIT: the column `event` had a negative value, which gave rise to the error.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at MTLR.label_transform and the fit_transform call shown in the report. Reproduce the error with the supplied time and event arrays, then inspect the event values; the report's edit identifies a negative event as the cause. Done means confirming the invalid input as the source of the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.