@Override
    protected void _transform(Dataframe newData) {
        ModelParameters modelParameters = knowledgeBase.getModelParameters();
        
        //convert data into matrix
        Map<Object, Integer> featureIds= modelParameters.getFeatureIds();
        
        Map<Integer, Integer> recordIdsReference = new HashMap<>();
        DataframeMatrix matrixDataset = DataframeMatrix.parseDataset(newData, recordIdsReference, featureIds);
        
        RealMatrix components = modelParameters.getComponents();
        
        
        //multiplying the data with components
        final RealMatrix X = matrixDataset.getX().multiply(components);
        
        streamExecutor.forEach(StreamMethods.stream(newData.entries(), isParallelized()), e -> {
            Integer rId = e.getKey();
            Record r = e.getValue();
            int rowId = recordIdsReference.get(rId);
            
            AssociativeArray xData = new AssociativeArray();
            int componentId=0;
            for(double value : X.getRow(rowId)) {
                xData.put(componentId++, value);
            }

            Record newR = new Record(xData, r.getY(), r.getYPredicted(), r.getYPredictedProbabilities());
            
            //we call below the recalculateMeta()
            newData._unsafe_set(rId, newR);
        });
        
        //recordIdsReference = null;
        //matrixDataset = null;
        
        newData.recalculateMeta();
    }
@ Override protected void _transform ( Dataframe newData ) { ModelParameters modelParameters = knowledgeBase . getModelParameters ( ) ; Map < Object , Integer > featureIds = modelParameters . getFeatureIds ( ) ; Map < Integer , Integer > recordIdsReference = new HashMap < > ( ) ; DataframeMatrix matrixDataset = DataframeMatrix . parseDataset ( newData , recordIdsReference , featureIds ) ; RealMatrix components = modelParameters . getComponents ( ) ; final RealMatrix X = matrixDataset . getX ( ) . multiply ( components ) ; streamExecutor . forEach ( StreamMethods . stream ( newData . entries ( ) , isParallelized ( ) ) , e -> { Integer rId = e . getKey ( ) ; Record r = e . getValue ( ) ; int rowId = recordIdsReference . get ( rId ) ; AssociativeArray xData = new AssociativeArray ( ) ; int componentId = 0 ; for ( double value : X . getRow ( rowId ) ) { xData . put ( componentId ++ , value ) ; } Record newR = new Record ( xData , r . getY ( ) , r . getYPredicted ( ) , r . getYPredictedProbabilities ( ) ) ; newData . _unsafe_set ( rId , newR ) ; } ) ; newData . recalculateMeta ( ) ; }
{@inheritDoc}