Skip to content

Commit 49bae1b

Browse files
authored
Fix typos in comments and docstrings (#1148)
1 parent 72bc453 commit 49bae1b

22 files changed

Lines changed: 48 additions & 48 deletions

skorch/_doctor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def add_activation_hooks(net, match_fn=None):
7272
7373
If an output is not a simple array, it is disambiguated. E.g. if it's a
7474
list, the name get a suffix of ``[i]`` where ``i`` designates the index in
75-
the list. Similary, when the output is a dict, a ``[key]`` suffix is added,
75+
the list. Similarly, when the output is a dict, a ``[key]`` suffix is added,
7676
where ``[key]`` is the key of the corresponding value in the dictionary.
7777
7878
Parameters
@@ -249,7 +249,7 @@ class SkorchDoctor(BaseEstimator):
249249
different parameter groups, or an adaptive optimizer like Adam.
250250
251251
- If gradients are too big, consider using gradient clipping. If the
252-
mangitude of gradients shifts over time, you might want to use a
252+
magnitude of gradients shifts over time, you might want to use a
253253
learning rate scheduler.
254254
255255
At the end of the day, ``SkorchDoctor`` will not tell you what you need to
@@ -333,7 +333,7 @@ class SkorchDoctor(BaseEstimator):
333333
334334
If an activation is not a simple array, it is disambiguated. E.g. if it's a
335335
list, the name get a suffix of ``[i]`` where ``i`` designates the index in
336-
the list. Similary, when the output is a dict, a ``[key]`` suffix is
336+
the list. Similarly, when the output is a dict, a ``[key]`` suffix is
337337
added, where ``[key]`` is the key of the corresponding value in the
338338
dictionary.
339339

skorch/callbacks/logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class PrintLog(Callback):
387387
388388
``PrintLog`` treats keys with the ``'event_'`` prefix in a special
389389
way. They are assumed to contain information about occasionally
390-
occuring events. The ``False`` or ``None`` entries (indicating
390+
occurring events. The ``False`` or ``None`` entries (indicating
391391
that an event did not occur) are not printed, resulting in empty
392392
cells in the table, and ``True`` entries are printed with ``+``
393393
symbol. ``PrintLog`` groups all event columns together and pushes
@@ -689,7 +689,7 @@ class TensorBoard(Callback):
689689
"""Logs results from history to TensorBoard
690690
691691
"TensorBoard provides the visualization and tooling needed for machine
692-
learning experimentation" (`offical docs
692+
learning experimentation" (`official docs
693693
<https://www.tensorflow.org/tensorboard/>`_).
694694
695695
Use this callback to automatically log all interesting values from your

skorch/callbacks/scoring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class BatchScoring(ScoringBase):
167167
the score for each batch and then averages the score at the end of
168168
the epoch. This can be disadvantageous for some scores if the
169169
batch size is small -- e.g. area under the ROC will return
170-
incorrect scores in this case. Therefore, it is recommnded to use
170+
incorrect scores in this case. Therefore, it is recommended to use
171171
:class:`.EpochScoring` unless you really need the scores for each
172172
batch.
173173

skorch/classifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"""
4343

4444
def get_neural_net_clf_doc(doc):
45-
# dedent/indent roundtrip required for consistent indention in both
45+
# dedent/indent roundtrip required for consistent indentation in both
4646
# Python <3.13 and Python >=3.13
4747
# Because <3.13 => no automatic dedent, but it is the case in >=3.13
4848
indentation = " "
@@ -255,7 +255,7 @@ def predict(self, X):
255255
is used by ``predict`` and ``predict_proba`` for classification."""
256256

257257
def get_neural_net_binary_clf_doc(doc):
258-
# dedent/indent roundtrip required for consistent indention in both
258+
# dedent/indent roundtrip required for consistent indentation in both
259259
# Python <3.13 and Python >=3.13
260260
# Because <3.13 => no automatic dedent, but it is the case in >=3.13
261261
indentation = " "

skorch/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def print_help(model, defaults=None):
258258
model : sklearn.base.BaseEstimator
259259
The basic model, e.g. a ``NeuralNet`` or sklearn ``Pipeline``.
260260
261-
defautls : dict or None (default=None)
261+
defaults : dict or None (default=None)
262262
Optionally, change the default values to use custom
263263
defaults. Commandline arguments have precedence over defaults.
264264

skorch/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def transform(self, X, y):
172172
By default, they are cast to PyTorch :class:`~torch.Tensor`\s.
173173
Override this if you want a different behavior.
174174
175-
Note: If you use this in conjuction with PyTorch
175+
Note: If you use this in conjunction with PyTorch
176176
:class:`~torch.utils.data.DataLoader`, the latter will call
177177
the dataset for each row separately, which means that the
178178
incoming ``X`` and ``y`` each are single rows.

skorch/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def shape(self):
219219
def transform(self, data):
220220
"""Additional transformations on ``data``.
221221
222-
Note: If you use this in conjuction with PyTorch
222+
Note: If you use this in conjunction with PyTorch
223223
:class:`~torch.utils.data.DataLoader`, the latter will call
224224
the dataset for each row separately, which means that the
225225
incoming ``data`` is a single rows.

skorch/hf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ class was added: Using this mixin in conjunction with the accelerate library
851851
852852
.. warning::
853853
854-
Since accelerate is still quite young and backwards compatiblity
854+
Since accelerate is still quite young and backwards compatibility
855855
breaking features might be added, we treat its integration as an
856856
experimental feature. When accelerate's API stabilizes, we will consider
857857
adding it to skorch proper.
@@ -1021,7 +1021,7 @@ def get_iterator(self, *args, **kwargs):
10211021

10221022
def _step_optimizer(self, step_fn):
10231023
# We cannot step_fn as a 'closure' to .step because GradScaler doesn't
1024-
# suppor it:
1024+
# support it:
10251025
# https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler.step
10261026
# Therefore, we need to call step_fn explicitly and step without
10271027
# argument.
@@ -1132,7 +1132,7 @@ class HfHubStorage:
11321132
11331133
Note that writes to the Hub are synchronous. Therefore, if the time it takes
11341134
to upload the data is long compared to training the model, there can be a
1135-
signficant slowdown. It is best to use this with
1135+
significant slowdown. It is best to use this with
11361136
:class:`skorch.callbacks.training.TrainEndCheckpoint`, as that checkpoint
11371137
only uploads the data once, at the end of training. Also, using this writer
11381138
with :class:`skorch.callbacks.training.LoadInitState` is not supported for

skorch/llm/classifier.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def _fit(self, X, y, **fit_params):
393393
def _predict_one(self, text):
394394
"""Make a prediction for a single sample
395395
396-
The returned probabilites are *not normalized* yet.
396+
The returned probabilities are *not normalized* yet.
397397
398398
Raises a ``LowProbabilityError`` if the total probability of all labels
399399
is 0, or, assuming ``error_low_prob`` is ``'raise'``, when it is below
@@ -534,7 +534,7 @@ class will be replaced by ``None`` if the sum of the probabilities is
534534
The label for each class.
535535
536536
"""
537-
# y_proba not normalized but it's not neeeded here
537+
# y_proba not normalized but it's not needed here
538538
y_proba = self._predict_proba(X)
539539
pred_ids = y_proba.argmax(1)
540540
y_pred = self.classes_[pred_ids]
@@ -704,7 +704,7 @@ class ZeroShotClassifier(_LlmBase):
704704
----------
705705
classes_ : ndarray of shape (n_classes, )
706706
A list of class labels known to the classifier. This attribute can be used
707-
to identify which column in the probabilties returned by ``predict_proba``
707+
to identify which column in the probabilities returned by ``predict_proba``
708708
corresponds to which class.
709709
710710
"""
@@ -932,7 +932,7 @@ class FewShotClassifier(_LlmBase):
932932
----------
933933
classes_ : ndarray of shape (n_classes, )
934934
A list of class labels known to the classifier. This attribute can be used
935-
to identify which column in the probabilties returned by ``predict_proba``
935+
to identify which column in the probabilities returned by ``predict_proba``
936936
corresponds to which class.
937937
938938
"""

skorch/net.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Neural net base class
22
33
This is the most flexible class, not making assumptions on the kind of
4-
task being peformed. Subclass this to create more specialized and
4+
task being performed. Subclass this to create more specialized and
55
sklearn-conforming classes like NeuralNetClassifier.
66
77
"""
@@ -144,7 +144,7 @@ class NeuralNet(BaseEstimator):
144144
this if your data is not supported. You should generally pass the
145145
uninitialized ``Dataset`` class and define additional arguments to
146146
X and y by prefixing them with ``dataset__``. It is also possible
147-
to pass an initialzed ``Dataset``, in which case no additional
147+
to pass an initialized ``Dataset``, in which case no additional
148148
arguments may be passed.
149149
150150
train_split : None or callable (default=skorch.dataset.ValidSplit(5))
@@ -700,7 +700,7 @@ def initialize_history(self):
700700
return self
701701

702702
def _format_reinit_msg(self, name, kwargs=None, triggered_directly=True):
703-
"""Returns a message that informs about re-initializing a compoment.
703+
"""Returns a message that informs about re-initializing a component.
704704
705705
Sometimes, the module or optimizer need to be
706706
re-initialized. Not only should the user receive a message
@@ -1593,7 +1593,7 @@ def forward_iter(self, X, training=False, device='cpu'):
15931593
15941594
device : string (default='cpu')
15951595
The device to store each inference result on.
1596-
This defaults to CPU memory since there is genereally
1596+
This defaults to CPU memory since there is generally
15971597
more memory available there. For performance reasons
15981598
this might be changed to a specific CUDA device,
15991599
e.g. 'cuda:0'.
@@ -1641,7 +1641,7 @@ def forward(self, X, training=False, device='cpu'):
16411641
16421642
device : string (default='cpu')
16431643
The device to store each inference result on.
1644-
This defaults to CPU memory since there is genereally
1644+
This defaults to CPU memory since there is generally
16451645
more memory available there. For performance reasons
16461646
this might be changed to a specific CUDA device,
16471647
e.g. 'cuda:0'.
@@ -2350,7 +2350,7 @@ def _set_params_callback(self, **params):
23502350
if '__' not in name and name in names:
23512351
self._replace_callback(name, params.pop(key))
23522352

2353-
# 3. Step parameters and other initilisation arguments
2353+
# 3. Step parameters and other initialisation arguments
23542354
for key in params.copy():
23552355
name = key[11:]
23562356
part0, part1 = name.split('__')
@@ -2527,12 +2527,12 @@ def _check_settable_attr(self, name, attr):
25272527
25282528
"""
25292529
if (self.init_context_ is None) and isinstance(attr, torch.nn.Module):
2530-
msg = ("Trying to set torch compoment '{}' outside of an initialize method."
2530+
msg = ("Trying to set torch component '{}' outside of an initialize method."
25312531
" Consider defining it inside 'initialize_module'".format(name))
25322532
raise SkorchAttributeError(msg)
25332533

25342534
if (self.init_context_ is None) and isinstance(attr, torch.optim.Optimizer):
2535-
msg = ("Trying to set torch compoment '{}' outside of an initialize method."
2535+
msg = ("Trying to set torch component '{}' outside of an initialize method."
25362536
" Consider defining it inside 'initialize_optimizer'".format(name))
25372537
raise SkorchAttributeError(msg)
25382538

0 commit comments

Comments
 (0)