File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -856,10 +856,14 @@ DataFrame >> crossTabulate: colName1 with: colName2 [
856856DataFrame >> dataPreProcessingEncodeWith: anEncoder [
857857 " This method is here to speed up pharo-ai/data-preprocessing algos without coupling both projects."
858858
859- | copy |
859+ | copy cache |
860860 copy := self copy.
861+ cache := IdentityDictionary new .
861862 self columns doWithIndex: [ :dataSerie :columnIndex |
862- dataSerie doWithIndex: [ :element :rowIndex | copy at: rowIndex at: columnIndex put: ((anEncoder categories at: columnIndex) indexOf: element) ] ].
863+ | category |
864+ category := cache at: columnIndex ifAbsentPut: [ ((anEncoder categories at: columnIndex) collectWithIndex: [ :elem :index | elem - > index ]) asDictionary ].
865+ dataSerie doWithIndex: [ :element :rowIndex |
866+ copy at: rowIndex at: columnIndex put: (category at: element ifAbsent: [ AIMissingCategory signalFor: element ]) ] ].
863867
864868 ^ copy
865869]
You can’t perform that action at this time.
0 commit comments