Pipeline & Qubit Suggestion¶
suggest_pipeline¶
quprep.core.recommender.suggest_pipeline(source, *, task='classification', qubits=None)
¶
Suggest a full pipeline configuration for a dataset and task.
Analyses the dataset to recommend which preprocessing stages to include
and which encoder to use. Extends :func:recommend from encoder-only
recommendation to a complete pipeline suggestion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str, Path, np.ndarray, pd.DataFrame, or Dataset
|
Input data. Accepts anything the pipeline ingester accepts. |
required |
task
|
str
|
Target task: |
'classification'
|
qubits
|
int
|
Maximum qubit budget. Influences reducer component count and encoder scoring. |
None
|
Returns:
| Type | Description |
|---|---|
PipelineSuggestion
|
Fully specified suggestion with a :meth: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
PipelineSuggestion¶
quprep.core.recommender.PipelineSuggestion(imputer, outlier_handler, reducer, reducer_n_components, normalizer, encoder, reason)
dataclass
¶
Auto-suggested full pipeline configuration for a dataset and task.
Attributes:
| Name | Type | Description |
|---|---|---|
imputer |
str or None
|
Suggested imputation strategy ( |
outlier_handler |
str or None
|
Suggested outlier method ( |
reducer |
str or None
|
Suggested reducer type ( |
reducer_n_components |
int or None
|
Suggested component count for the reducer. |
normalizer |
str
|
Suggested :class: |
encoder |
str
|
Suggested encoding method (matches :attr: |
reason |
str
|
Human-readable explanation of the choices made. |
preprocessing_report¶
quprep.ingest.profiler.preprocessing_report(dataset, *, encoder=None, qubit_budget=None)
¶
Produce actionable preprocessing recommendations for a dataset.
Extends :func:profile from statistics to concrete action items: which
columns need imputation, whether outlier removal is advisable, whether
dimensionality reduction is needed for the qubit budget, encoder value-
range compatibility issues, and class imbalance warnings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Dataset
|
|
required |
encoder
|
BaseEncoder
|
If provided, check value-range compatibility and suggest the correct normalizer. |
None
|
qubit_budget
|
int
|
Maximum qubit count. Flag when |
None
|
Returns:
| Type | Description |
|---|---|
PreprocessingReport
|
|
PreprocessingReport¶
quprep.ingest.profiler.PreprocessingReport(recommendations=list(), n_issues=0)
dataclass
¶
Actionable preprocessing recommendations for a dataset.
Produced by :func:preprocessing_report. Each entry in
recommendations is a concrete action the user should take.
Attributes:
| Name | Type | Description |
|---|---|---|
recommendations |
list[str]
|
Ordered list of actionable recommendations. |
n_issues |
int
|
Number of recommendations (0 = dataset is ready to encode). |
suggest_qubits¶
quprep.core.qubit_suggestion.suggest_qubits(source, *, task='classification', max_qubits=None)
¶
Suggest an appropriate qubit budget for a dataset.
Analyses the dataset's feature count and sample count to recommend a qubit count that is practical on NISQ hardware. For datasets with more features than the budget allows, a dimensionality reduction step is recommended.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str, Path, np.ndarray, pd.DataFrame, or Dataset
|
Input data. |
required |
task
|
str
|
Target task: 'classification', 'regression', 'qaoa', 'kernel', 'simulation'. Influences the encoding hint. |
'classification'
|
max_qubits
|
int
|
Hard upper bound on the suggestion. Defaults to 20 (practical NISQ ceiling). |
None
|
Returns:
| Type | Description |
|---|---|
QubitSuggestion
|
|
Source code in quprep/core/qubit_suggestion.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
QubitSuggestion¶
quprep.core.qubit_suggestion.QubitSuggestion(n_qubits, n_features, nisq_safe, encoding_hint, reasoning, warning)
dataclass
¶
Qubit budget recommendation for a dataset.
Attributes:
| Name | Type | Description |
|---|---|---|
n_qubits |
int
|
Recommended qubit count. |
n_features |
int
|
Number of features in the dataset (before any reduction). |
nisq_safe |
bool
|
|
encoding_hint |
str
|
Encoding that works well at this qubit count and task. |
reasoning |
str
|
Human-readable explanation of the recommendation. |
warning |
str or None
|
Warning if dimensionality reduction is strongly recommended. |
Examples¶
Auto-suggest and build a pipeline¶
import quprep as qd
suggestion = qd.suggest_pipeline(dataset, task="classification", qubits=8)
print(suggestion) # PipelineSuggestion(encoder='iqp', normalizer='minmax_2pi', ...)
pipeline = suggestion.build()
result = pipeline.fit_transform(dataset)