diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-01-30 22:33:53 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-01-30 22:36:17 +0100 |
commit | 4236aafa0dc68caeea85c785c83524ecb2b87783 (patch) | |
tree | bfe992895ace7b0248939df8ee90c1c926311e4c /examples | |
parent | 23816f14036a46d0a43d6fa7f004d6a00542b6c3 (diff) |
py-machine-learning: Print CSV line numbers for invalid lines (SKLearn Random Forest Classificator).
* c-analysed: fix wrong length check
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c-analysed/c-analysed.c | 2 | ||||
-rwxr-xr-x | examples/py-machine-learning/sklearn-random-forest.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/c-analysed/c-analysed.c b/examples/c-analysed/c-analysed.c index 1a9e56280..e9c71b978 100644 --- a/examples/c-analysed/c-analysed.c +++ b/examples/c-analysed/c-analysed.c @@ -148,7 +148,7 @@ static void csv_buf_add(csv_buf_t buf, size_t * const csv_buf_used, char const * { size_t len; - if (siz_len > 1 && str != NULL) + if (siz_len > 0 && str != NULL) { len = MIN(BUFFER_REMAINING(*csv_buf_used), siz_len); if (len == 0) diff --git a/examples/py-machine-learning/sklearn-random-forest.py b/examples/py-machine-learning/sklearn-random-forest.py index 090206b4e..9103bb427 100755 --- a/examples/py-machine-learning/sklearn-random-forest.py +++ b/examples/py-machine-learning/sklearn-random-forest.py @@ -280,7 +280,7 @@ if __name__ == '__main__': X += getRelevantFeaturesCSV(line) y += [isProtoClass(args.proto_class, line['proto'])] except RuntimeError as err: - print('Error: `{}\'\non line: {}'.format(err, line)) + print('Error: `{}\'\non line {}: {}'.format(err, reader.line_num - 1, line)) sys.stderr.write('CSV data set contains {} entries.\n'.format(len(X))) |