Intro to QCML
This example demonstrates how to use QCMLClassifier for binary classification on the breast cancer dataset. The QCMLClassifier is available as a scikit-learn wrapper and can be used in a similar manner to other sklearn models.
Basic Usage
QCMLClassifier follows the standard scikit-learn API:
Initialize the QCMLClassifier model
Call fit method to train the model
Call predict method to generate label forecasts
Call predict_proba method to generate probability forecasts
Example Code
Below is a complete example for binary classification on the breast cancer dataset:
from sklearn import datasets
from honeio.integrations.sklearn.qcmlsklearn import QCMLClassifier
# Load the breast cancer dataset
X, y = datasets.load_breast_cancer(return_X_y=True)
# Initialize the QCMLClassifier model
model = QCMLClassifier(epochs=10)
# Train the model
model.fit(X, y)
# Generate predictions
label_forecasts = model.predict(X)
label_forecasts_prob = model.predict_proba(X)
# Display results
print(f"Label forecasts: \\n {label_forecasts[:10]}")
print(f"Label probability forecasts: \\n {label_forecasts_prob[:10]}")
Expected Output
When you run this example, you will see output similar to:
2025-08-07 11:16:36 [warning ]
You are using the community edition of honeio.
There are some limitations that can be lifted by purchasing a commercial license.
Please contact support@qognitive.io for more information.
Label forecasts:
[0 0 1 1 1 1 1 1 1 1]
Label probability forecasts:
[[0.5511179 0.4488821 ]
[0.50000954 0.49999046]
[0.49653196 0.5034681 ]
[0.43009955 0.5699005 ]
[0.4775708 0.5224293 ]
[0.45627534 0.54372466]
[0.4922443 0.50775564]
[0.47517487 0.5248251 ]
[0.4393727 0.5606274 ]
[0.43882385 0.5611761 ]]
Understanding the Results
- Label Forecasts
The
predict()method returns binary predictions (0 or 1) for each sample.- Probability Forecasts
The
predict_proba()method returns the probability of each class for each sample. Each row contains two values:First column: Probability of class 0 (malignant)
Second column: Probability of class 1 (benign)
The probabilities in each row sum to 1.0.
- Community Edition Notice
The warning messages indicate you’re using the community edition of honeio, which has some limitations. Contact support@qognitive.io for commercial licensing information.
Key Parameters
- epochs (int, default=100)
The number of training epochs. In this example, we use 10 epochs for faster execution.
For a complete list of parameters, see the Scikit-learn Integration documentation.
Next Steps
Try different values for
epochsto see how it affects performanceExperiment with other datasets using
datasets.make_classification()Explore hyperparameter tuning with
GridSearchCVCompare performance with traditional sklearn classifiers
- Related Examples
See Binary Classification for binary classification with rigorous evaluation
Check Multiclass Classification for 10-class classification examples
Try Regression for continuous target prediction examples
Explore GPU vs CPU Benchmark for hardware performance optimization
Review Scikit-learn Integration for parameter descriptions