@@ -324,13 +324,15 @@ def apply_column_filters(df, input_filters_dict ):
324
324
def convert_to_unique (t1 ):
325
325
''' convert unique values in an numpy.array into
326
326
indices into the unique array
327
+
327
328
arguments:
328
329
t1 numpy scalar array
330
+
329
331
return
330
332
t1 with each value changed to an index 0 to number of unique
331
333
values in t1-1
332
334
'''
333
- t2 = t1
335
+ t2 = np . zeros (( len ( t1 ),), dtype = np . int32 )
334
336
unique = np .unique (t1 )
335
337
for i ,u in enumerate (unique ):
336
338
t2 [t1 == u ]= i
@@ -519,19 +521,19 @@ class DataSets(object):
519
521
feature_name .append (colName )
520
522
521
523
elif colName == 'm_label_one_hot' :
522
- t1 = np .array (df ['m_label' ] , dtype = np . uint16 )
524
+ t1 = np .array (df ['m_label' ] )
523
525
t1 = convert_to_unique (t1 )
524
526
one_hot_map [- 1 ] = len (np .unique (t1 ))
525
527
feature_name .append (colName )
526
528
527
529
elif colName == 'font_one_hot' :
528
- t1 = np .array (df ['font' ] , dtype = np . uint16 )
530
+ t1 = np .array (df ['font' ])
529
531
t1 = convert_to_unique (t1 )
530
532
one_hot_map [- 1 ] = len (np .unique (t1 ))
531
533
feature_name .append (colName )
532
534
533
535
elif colName == 'fontVariant_one_hot' :
534
- t1 = np .array (df ['fontVariant' ] , dtype = np . uint16 )
536
+ t1 = np .array (df ['fontVariant' ] )
535
537
t1 = convert_to_unique (t1 )
536
538
one_hot_map [- 1 ] = len (np .unique (t1 ))
537
539
feature_name .append (colName )
0 commit comments