이 답변은 해결책이 아니라 취할 수있는 방향에 대한 제안입니다. 거리 메트릭에 대한 JSL 행렬 함수를 참조하십시오. 마찬가지로 클러스터링이나 차별과 같이 집적 거리를 기반으로하는 JMP 플랫폼을 사용할 수도 있습니다.
- 룩업 테이블 (효율)이 IOUT 열에서 로우에서 하이로 정렬된다고 가정하면
- 조회 테이블이 실제 크기가 아니라고 가정합니다. 사용되는 방법론은 그리 효율적이지 않습니다.
이 코드는 잘 작동해야합니다.
/* Open a sample data table */
//dt = Open( "C:\Users\Test\Sample data\Sample1.jmp" );
dt = Data Table( "Sample1" );
/* Add a column for the assignment */
dt << New Column( "Efficiency", Numeric );
/* Open a lookup table */
//lt = Open( "C:\Users\Test\Sample data\efficiency_0.7.jmp" );
lt = Data Table( "efficiency" );
/* Loop through each row of the original data table */
For( i = 1, i <= N Rows( dt ), i++,
// Find the row with the closest IOUT value below the data value
theLowRow = Max( lt << get rows where( lt:IOUT <= dt:data[i] ) );
// Get the IOUT value for theLowRow
low = lt:IOUT[theLowRow];
// Find the row with the closest IOUT value above the data value
theHighRow = Min( lt << get rows where( lt:IOUT >= dt:data[i] ) );
// Get the IOUT value for theLowRow
high = lt:IOUT[theHighRow];
// Find the closest of these two values and write the Efficiency value
If( Abs( low - dt:data[i] ) < Abs( high - dt:data[i] ),
dt:Efficiency[i] = lt:low[theLowRow],
dt:Efficiency[i] = lt:low[theHighRow]
);
/*/* Obtain a matrix contining the row number of the lookup table
where the current falls within the range */
lowRange = lt << Get Rows Where(
Column( lt, "IOUT" )[] < Column( dt, "data" )[i] &
Column( dt, "data" )[i] <= Column( lt, "IOUT" )[]
);
/* Extract the row number from the matrix */
r = lowRange[1];
/* Assign the efficiency value to the original data table */
Column( dt, "Efficiency" )[i] = Column( lt, "low" )[r];*/
);