Memuat
Memuat
Support Vector Machine (fitcsvm) for Chemistry and Materials
0 views
Classify crystal phase with an SVM using the features main peak position and relative peak intensity. fitcsvm trains a Support Vector Machine for binary classification with various kernels. It suits classification on small to medium data with complex class boundaries.

Classify crystal phase with an SVM using the features main peak position and relative peak intensity.
| Role | Variable | Unit |
|---|---|---|
| Main | Crystal phase | - |
| Supporting 1 | Main peak position | deg |
| Supporting 2 | Relative peak intensity | % |
The RBF-kernel SVM classifies Crystal phase with a test accuracy of 0.906 and F1 of 0.927 using 88 support vectors; the best cross-validated accuracy of 0.915 occurs at C=1.00.
Computed from illustrative synthetic data, not from a real study.
fitcsvm trains a Support Vector Machine for binary classification with various kernels. It suits classification on small to medium data with complex class boundaries.
Report the kernel, hyperparameters, test metrics, and the number of support vectors. Acknowledge the limited interpretability of a black-box model.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
rng(6);
n = 300;
main_peak_position = randn(n, 2);
crystal_phase = double(sum(main_peak_position.^2, 2) > 1.4); % circular class boundary
cv = cvpartition(crystal_phase, 'HoldOut', 0.25);
Xtr = main_peak_position(training(cv), :); ytr = crystal_phase(training(cv));
Xte = main_peak_position(test(cv), :); yte = crystal_phase(test(cv));
best = inf;
for C = [0.1 1 10 100]
m = fitcsvm(Xtr, ytr, 'KernelFunction', 'rbf', 'KernelScale', 'auto', ...
'BoxConstraint', C, 'Standardize', true);
err = kfoldLoss(crossval(m, 'KFold', 5));
if err < best, best = err; Cbest = C; end
end
mdl = fitcsvm(Xtr, ytr, 'KernelFunction', 'rbf', 'KernelScale', 'auto', ...
'BoxConstraint', Cbest, 'Standardize', true);
[pred, score] = predict(mdl, Xte);
[~, ~, ~, auc] = perfcurve(yte, score(:, 2), 1);
fprintf('Best C = %g, CV error = %.3f\n', Cbest, best);
fprintf('Test accuracy = %.3f, AUC = %.3f, support vectors = %d\n', mean(pred == yte), auc, sum(mdl.IsSupportVector));
disp(confusionmat(yte, pred));
[g1, g2] = meshgrid(linspace(-3, 3, 150));
gp = predict(mdl, [g1(:) g2(:)]);
figure; gscatter(g1(:), g2(:), gp, [0.9 0.9 1; 1 0.9 0.9]); hold on;
gscatter(Xte(:,1), Xte(:,2), yte, 'br', 'ox');
xlabel('x_1'); ylabel('x_2'); title('SVM decision regions');Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$28
excl. 11% VAT
Duration: 5 working days
Output: MATLAB files + result figures
Deliverables
Package 2 · most chosen
US$81
excl. 11% VAT
Duration: 9 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$178
excl. 11% VAT
Duration: 14-17 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Support Vector Machine (fitcsvm) is commonly used at this level in Chemistry and Materials. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output MATLAB gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$28, Package 2 (your data analysis and interpretation) US$81 and Package 3 (full guidance) US$178, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. MATLAB is a trademark of The MathWorks, Inc.
Back to MATLAB portfolio