1200 pixels spectral datasets
收藏NIAID Data Ecosystem2026-05-02 收录
下载链接:
https://zenodo.org/record/11082599
下载链接
链接失效反馈官方服务:
资源简介:
In the Zip, spectral. npy was the average spectral data of red ginseng, mycotoxins and interference impurities, and label. npy was the corresponding label. Spectral data format was [1200,510] and label data format was [1200,1]. The example of data usage (sklearn in Python database was used to establish the classification model) was as follows:
import numpy as npfrom sklearn. model_selection import train_test_splitfrom sklearn. preprocessing import StandardScalerfrom sklearn. neighbors import KNeighborsClassifierfrom sklearn. metrics import classification_report, accuracy_score
# Load spectral data and labelsx = np.load('.../spectral.npy')[:,1:-1]y = np.load('.../label.npy')
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=42)
# Data standardizationscaler = StandardScaler()x_train = scaler.fit_transform(x_train)x_test = scaler.transform(x_test)
# Train the KNN modelknn_model = KNeighborsClassifier(n_neighbors=5) knn_model. fit(x_train, y_train)
# Predicty_pred = knn_model.predict(x_test)
# Print classification reports and accuracy ratesprint("Classification Report:")print(classification_report(y_test, y_pred))print("Accuracy Score:")print(accuracy_score(y_test, y_pred))
创建时间:
2024-05-21



