Hi Ming-Chou,
WL has a PrincipalComponents function that may work for you.
A suggestion on your code. Evaluating ToExpression on data from an external source can pose a security risk. Here is an alternative
dataset =
Import["https://raw.githubusercontent.com/selva86/datasets/master/BostonHousing.csv",
"Dataset",
HeaderLines -> 1];
dataPredict = dataset[All, Most@Values@# -> Last@Values@# &] // Normal
It is important to randomize the data before analyzing it to remove any bias from the way the data is sorted. The ResourceFunction TrainTestSplit is useful for this.
{train, test} = ResourceFunction["TrainTestSplit"][dataPredict];
p = Predict[train];
There is a typo in the code, p should be passed to PredictorMeasurements, not p1.