PyDLLib 1.0__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_RMSPROP.py +1 -1
  2. pydllib-1.0.2/DLL/MachineLearning/SupervisedLearning/GaussianProcesses/_GaussianProcessClassifier.py +259 -0
  3. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/GaussianProcesses/_GaussianProcessRegressor.py +33 -35
  4. pydllib-1.0.2/DLL/MachineLearning/SupervisedLearning/GaussianProcesses/__init__.py +2 -0
  5. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Kernels.py +3 -2
  6. pydllib-1.0.2/PKG-INFO +54 -0
  7. pydllib-1.0.2/PyDLLib.egg-info/PKG-INFO +54 -0
  8. {pydllib-1.0 → pydllib-1.0.2}/PyDLLib.egg-info/SOURCES.txt +1 -0
  9. pydllib-1.0.2/PyDLLib.egg-info/requires.txt +12 -0
  10. {pydllib-1.0 → pydllib-1.0.2}/README.md +10 -7
  11. {pydllib-1.0 → pydllib-1.0.2}/pyproject.toml +1 -1
  12. pydllib-1.0.2/requirements.txt +12 -0
  13. pydllib-1.0/DLL/MachineLearning/SupervisedLearning/GaussianProcesses/__init__.py +0 -1
  14. pydllib-1.0/PKG-INFO +0 -104
  15. pydllib-1.0/PyDLLib.egg-info/PKG-INFO +0 -104
  16. pydllib-1.0/PyDLLib.egg-info/requires.txt +0 -65
  17. pydllib-1.0/requirements.txt +0 -65
  18. {pydllib-1.0 → pydllib-1.0.2}/DLL/Data/Metrics.py +0 -0
  19. {pydllib-1.0 → pydllib-1.0.2}/DLL/Data/Preprocessing.py +0 -0
  20. {pydllib-1.0 → pydllib-1.0.2}/DLL/Data/_DataReader.py +0 -0
  21. {pydllib-1.0 → pydllib-1.0.2}/DLL/Data/__init__.py +0 -0
  22. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Callbacks/_BackUp.py +0 -0
  23. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Callbacks/_BaseCallback.py +0 -0
  24. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Callbacks/_EarlyStopping.py +0 -0
  25. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Callbacks/_ReduceLROnPlateau.py +0 -0
  26. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Callbacks/__init__.py +0 -0
  27. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Initialisers/_Initialiser.py +0 -0
  28. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Initialisers/_Kaiming_He.py +0 -0
  29. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Initialisers/_Xavier_Glorot.py +0 -0
  30. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Initialisers/__init__.py +0 -0
  31. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Activations/_Activation.py +0 -0
  32. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Activations/_ReLU.py +0 -0
  33. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Activations/_Sigmoid.py +0 -0
  34. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Activations/_SoftMax.py +0 -0
  35. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Activations/_Tanh.py +0 -0
  36. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Activations/__init__.py +0 -0
  37. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/_BaseRegularisation.py +0 -0
  38. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/_BatchNormalisation.py +0 -0
  39. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/_Dropout.py +0 -0
  40. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/_GroupNormalisation.py +0 -0
  41. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/_InstanceNormalisation.py +0 -0
  42. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/_LayerNormalisation.py +0 -0
  43. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/Regularisation/__init__.py +0 -0
  44. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Add.py +0 -0
  45. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Attention.py +0 -0
  46. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_BaseLayer.py +0 -0
  47. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Bidirectional.py +0 -0
  48. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Conv2D.py +0 -0
  49. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Dense.py +0 -0
  50. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_DenseKAN.py +0 -0
  51. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Flatten.py +0 -0
  52. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Identity.py +0 -0
  53. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Input.py +0 -0
  54. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_LSTM.py +0 -0
  55. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_LayerList.py +0 -0
  56. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_MaxPooling2D.py +0 -0
  57. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_RNN.py +0 -0
  58. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/_Reshape.py +0 -0
  59. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Layers/__init__.py +0 -0
  60. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_BCE.py +0 -0
  61. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_BaseLoss.py +0 -0
  62. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_CCE.py +0 -0
  63. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_Exponential.py +0 -0
  64. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_Huber.py +0 -0
  65. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_MAE.py +0 -0
  66. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/_MSE.py +0 -0
  67. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Losses/__init__.py +0 -0
  68. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Model.py +0 -0
  69. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_ADADELTA.py +0 -0
  70. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_ADAGRAD.py +0 -0
  71. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_ADAM.py +0 -0
  72. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_BaseOptimiser.py +0 -0
  73. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_LBFGS.py +0 -0
  74. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/_SGD.py +0 -0
  75. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/Optimisers/__init__.py +0 -0
  76. {pydllib-1.0 → pydllib-1.0.2}/DLL/DeepLearning/__init__.py +0 -0
  77. {pydllib-1.0 → pydllib-1.0.2}/DLL/Exceptions/_Exceptions.py +0 -0
  78. {pydllib-1.0 → pydllib-1.0.2}/DLL/Exceptions/__init__.py +0 -0
  79. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Calibration/_CalibratedClassifier.py +0 -0
  80. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Calibration/_IsotonicRegression.py +0 -0
  81. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Calibration/__init__.py +0 -0
  82. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/TimeSeries.py +0 -0
  83. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/_Elasticnet.py +0 -0
  84. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/_LassoRegression.py +0 -0
  85. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/_LinearRegression.py +0 -0
  86. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/_LogisticRegression.py +0 -0
  87. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/_RANSAC.py +0 -0
  88. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/_RidgeRegression.py +0 -0
  89. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/LinearModels/__init__.py +0 -0
  90. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/NaiveBayes/_BernoulliNaiveBayes.py +0 -0
  91. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/NaiveBayes/_GaussianNaiveBayes.py +0 -0
  92. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/NaiveBayes/_MultinomialNaiveBayes.py +0 -0
  93. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/NaiveBayes/__init__.py +0 -0
  94. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Neighbors/_KNearestNeighborsClassifier.py +0 -0
  95. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Neighbors/_KNearestNeighborsRegressor.py +0 -0
  96. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Neighbors/__init__.py +0 -0
  97. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/SupportVectorMachines/_SVC.py +0 -0
  98. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/SupportVectorMachines/_SVR.py +0 -0
  99. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/SupportVectorMachines/__init__.py +0 -0
  100. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_AdaBoostClassifier.py +0 -0
  101. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_AdaBoostRegressor.py +0 -0
  102. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_DecisionTree.py +0 -0
  103. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_GradientBoostingClassifier.py +0 -0
  104. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_GradientBoostingRegressor.py +0 -0
  105. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_LGBMClassifier.py +0 -0
  106. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_LGBMRegressor.py +0 -0
  107. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_LGBMTree.py +0 -0
  108. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_RandomForest.py +0 -0
  109. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_RegressionForest.py +0 -0
  110. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_RegressionTree.py +0 -0
  111. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_XGBoostClassifier.py +0 -0
  112. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_XGBoostRegressor.py +0 -0
  113. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/_XGBoostTree.py +0 -0
  114. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/Trees/__init__.py +0 -0
  115. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/SupervisedLearning/__init__.py +0 -0
  116. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/Clustering/_DBScan.py +0 -0
  117. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/Clustering/_GaussianMixtureModels.py +0 -0
  118. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/Clustering/_KMeans.py +0 -0
  119. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/Clustering/_SpectralClustering.py +0 -0
  120. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/Clustering/__init__.py +0 -0
  121. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/_LDA.py +0 -0
  122. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/_PCA.py +0 -0
  123. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/_QDA.py +0 -0
  124. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/_RobustPCA.py +0 -0
  125. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/_TSNE.py +0 -0
  126. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/_UMAP.py +0 -0
  127. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/DimensionalityReduction/__init__.py +0 -0
  128. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/OutlierDetection/_IsolationForest.py +0 -0
  129. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/OutlierDetection/__init__.py +0 -0
  130. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/UnsupervisedLearning/__init__.py +0 -0
  131. {pydllib-1.0 → pydllib-1.0.2}/DLL/MachineLearning/__init__.py +0 -0
  132. {pydllib-1.0 → pydllib-1.0.2}/DLL/__init__.py +0 -0
  133. {pydllib-1.0 → pydllib-1.0.2}/LICENSE +0 -0
  134. {pydllib-1.0 → pydllib-1.0.2}/PyDLLib.egg-info/dependency_links.txt +0 -0
  135. {pydllib-1.0 → pydllib-1.0.2}/PyDLLib.egg-info/top_level.txt +0 -0
  136. {pydllib-1.0 → pydllib-1.0.2}/setup.cfg +0 -0
@@ -5,7 +5,7 @@ from ._BaseOptimiser import BaseOptimiser
5
5
 
6
6
  class RMSPROP(BaseOptimiser):
7
7
  """
8
- The adaptive moment estimation optimiser. Is very robust and does not require a lot of tuning it's hyperparameters. A first order method and therefore does not use information on second gradients, i.e. the hessian matrix. Hence, does not require a lot of memory.
8
+ The Root Mean Square Propagation optimiser. An improvement over the ADAGRAD optimiser solving the diminishing learning rate problem. A first order method and therefore does not use information on second gradients, i.e. the hessian matrix. Hence, does not require a lot of memory.
9
9
 
10
10
  Args:
11
11
  learning_rate (float, optional): The learning rate of the optimiser. Must be positive. Defaults to 0.001.
@@ -0,0 +1,259 @@
1
+ import torch
2
+ from math import floor
3
+
4
+ from ..Kernels import _Base
5
+ from ....DeepLearning.Optimisers import ADAM
6
+ from ....DeepLearning.Optimisers._BaseOptimiser import BaseOptimiser
7
+ from ....Exceptions import NotFittedError
8
+
9
+
10
+ LAMBDAS = torch.tensor([0.41, 0.4, 0.37, 0.44, 0.39]).unsqueeze(-1)
11
+ COEFS = torch.tensor([-1854.8214151, 3516.89893646, 221.29346712, 128.12323805, -2010.49422654]).unsqueeze(-1)
12
+
13
+
14
+ class GaussianProcessClassifier:
15
+ """
16
+ Implements the Gaussian process classification model for binary classes. This model can be extended to multiclass classification by OvO or OvR. This implementation is adapted from the sklearn implementation and is based chapters 3 and 5 of on `this book <https://gaussianprocess.org/gpml/chapters/RW.pdf>`_.
17
+
18
+ Args:
19
+ covariance_function (:ref:`kernel_section_label`, optional): The kernel function expressing how similar are different samples.
20
+ noise (int | float, optional): The artificially added noise to the model. Is added as variance to each sample. Must be non-negative. Defaults to 0.
21
+ n_iter_laplace_mode (int, optional): The max amount of Newton iterations used to find the mode of the Laplace approximation. Must be a positive integer. Defaults to 100.
22
+ epsilon (float, optional): Implemented similarly to noise. Makes sure the covariance matrix is positive definite and hence invertible. Must be positive. Defaults to 1e-5. If one gets a RunTimeError for a matrix not being invertible, one should increase this parameter.
23
+ device (torch.device, optional): The device of all matrices. Defaults to torch.device("cpu").
24
+
25
+ Attributes:
26
+ n_features (int): The number of features. Available after fitting.
27
+ """
28
+ def __init__(self, covariance_function, noise=0, n_iter_laplace_mode=100, epsilon=1e-5, device=torch.device("cpu")):
29
+ if not isinstance(covariance_function, _Base):
30
+ raise TypeError("covariance_function must be from DLL.MachineLearning.Supervisedlearning.Kernels.")
31
+ if not isinstance(noise, int | float) or noise < 0:
32
+ raise ValueError("noise must be non-negative.")
33
+ if not isinstance(n_iter_laplace_mode, int) or n_iter_laplace_mode <= 0:
34
+ raise ValueError("n_iter_laplace_mode must be a positive integer.")
35
+ if not isinstance(epsilon, int | float) or epsilon <= 0:
36
+ raise ValueError("epsilon must be positive.")
37
+ if not isinstance(device, torch.device):
38
+ raise TypeError("device must be an instance of torch.device.")
39
+
40
+ self.covariance_function = covariance_function
41
+ self.noise = noise
42
+ self.n_iter_laplace_mode = n_iter_laplace_mode
43
+ self.epsilon = epsilon
44
+ self.device = device
45
+
46
+ def _get_covariance_matrix(self, X1, X2):
47
+ return self.covariance_function(X1, X2).to(X1.dtype).to(self.device)
48
+
49
+ def fit(self, X, y):
50
+ """
51
+ Fits the GaussianProcessClassifier model to the input data.
52
+
53
+ Args:
54
+ X (torch.Tensor of shape (n_samples, n_features)): The input data, where each row is a sample and each column is a feature.
55
+ y (torch.Tensor of shape (n_samples,)): The target values corresponding to each sample. Should be normalized to zero mean and one variance. Every element must be in [0, 1].
56
+ Returns:
57
+ None
58
+ Raises:
59
+ TypeError: If the input matrix or the target matrix is not a PyTorch tensor.
60
+ ValueError: If the input matrix or the target matrix is not the correct shape.
61
+ """
62
+ if not isinstance(X, torch.Tensor) or not isinstance(y, torch.Tensor):
63
+ raise TypeError("The input matrix and the target matrix must be a PyTorch tensor.")
64
+ if X.ndim != 2:
65
+ raise ValueError("The input matrix must be a 2 dimensional tensor.")
66
+ if y.ndim != 1 or len(y) != len(X):
67
+ raise ValueError("The targets must be 1 dimensional with the same number of samples as the input data")
68
+ if len(y) < 2:
69
+ raise ValueError("There must be atleast 2 samples.")
70
+ vals = torch.unique(y).numpy()
71
+ if set(vals) != {0, 1}:
72
+ raise ValueError("y must only contain the values in [0, 1].")
73
+
74
+ self.n_features = X.shape[1]
75
+ self.X = X
76
+ self.Y = y
77
+ self.prior_covariance_matrix = self._get_covariance_matrix(X, X) + (self.noise + self.epsilon) * torch.eye(len(X), device=self.device)
78
+ _, (self._pi, self._W_sr, self._L, _, _) = self._posterior_mode() # save necessary things for the predictions
79
+
80
+ def predict(self, X):
81
+ """
82
+ Applies the fitted GaussianProcessClassifier model to the input data, predicting the correct values.
83
+
84
+ Args:
85
+ X (torch.Tensor of shape (n_samples, n_features)): The input data to be regressed.
86
+ Returns:
87
+ mean, covariance (tuple[torch.Tensor of shape (n_samples,), torch.Tensor of shape (n_samples, n_samples)): A tuple containing the posterior mean and posterior covariance. As the prediction, one should use the mean.
88
+ Raises:
89
+ NotFittedError: If the GaussianProcessClassifier model has not been fitted before predicting.
90
+ TypeError: If the input matrix is not a PyTorch tensor.
91
+ ValueError: If the input matrix is not the correct shape.
92
+ """
93
+ if not hasattr(self, "prior_covariance_matrix"):
94
+ raise NotFittedError("GaussianProcessClassifier.fit() must be called before predicting.")
95
+ if not isinstance(X, torch.Tensor):
96
+ raise TypeError("The input matrix must be a PyTorch tensor.")
97
+ if X.ndim != 2 or X.shape[1] != self.n_features:
98
+ raise ValueError("The input matrix must be a 2 dimensional tensor with the same number of features as the fitted tensor.")
99
+
100
+ K = self._get_covariance_matrix(self.X, X)
101
+ f_star = K.T @ (self.Y - self._pi)
102
+ return torch.where(f_star > 0, 1, 0)
103
+
104
+ def predict_proba(self, X):
105
+ """
106
+ Applies the fitted GaussianProcessClassifier model to the input data, predicting the probabilities of each class.
107
+
108
+ Args:
109
+ X (torch.Tensor of shape (n_samples, n_features)): The input data to be regressed.
110
+ Returns:
111
+ probabilities (tuple[torch.Tensor of shape (n_samples,)): The probabilities that the class belongs to class 1.
112
+ Raises:
113
+ NotFittedError: If the GaussianProcessClassifier model has not been fitted before predicting.
114
+ TypeError: If the input matrix is not a PyTorch tensor.
115
+ ValueError: If the input matrix is not the correct shape.
116
+ """
117
+ if not hasattr(self, "prior_covariance_matrix"):
118
+ raise NotFittedError("GaussianProcessClassifier.fit() must be called before predicting.")
119
+ if not isinstance(X, torch.Tensor):
120
+ raise TypeError("The input matrix must be a PyTorch tensor.")
121
+ if X.ndim != 2 or X.shape[1] != self.n_features:
122
+ raise ValueError("The input matrix must be a 2 dimensional tensor with the same number of features as the fitted tensor.")
123
+
124
+ K = self._get_covariance_matrix(self.X, X)
125
+ f_star = K.T @ (self.Y - self._pi)
126
+ v = torch.linalg.solve(self._L, self._W_sr.unsqueeze(-1) * K)
127
+ var_f_star = torch.diag(self._get_covariance_matrix(X, X)) - torch.diag(v.T @ v)
128
+
129
+ alpha = 1 / (2 * var_f_star)
130
+ gamma = LAMBDAS * f_star
131
+ integrals = torch.sqrt(torch.pi / alpha) * torch.erf(gamma * torch.sqrt(alpha / (alpha + LAMBDAS ** 2))) / (2 * torch.sqrt(var_f_star * 2 * torch.pi))
132
+ pi_star = (COEFS * integrals).sum(axis=0) + 0.5 * COEFS.sum()
133
+ return pi_star
134
+
135
+ def log_marginal_likelihood(self):
136
+ """
137
+ Computes the log marginal likelihood of the current model. This value is used to optimize hyperparameters.
138
+
139
+ Returns:
140
+ log marginal likelihood (float): The log marginal likelihood of the current model.
141
+ """
142
+ if not hasattr(self, "prior_covariance_matrix"):
143
+ raise NotFittedError("GaussianProcessClassifier.fit() must be called before calculating the log marginal likelihood.")
144
+
145
+ return self._posterior_mode()[0]
146
+
147
+ def _posterior_mode(self):
148
+ # adapted from sklearn source code: https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73a86f5f11781a0e21f24c8f47979ec67/sklearn/gaussian_process/_gpc.py#L269
149
+ f = self._f_cached if hasattr(self, "_f_cached") else torch.zeros_like(self.Y)
150
+ log_marginal_likelihood = -torch.inf
151
+ K = self.prior_covariance_matrix
152
+ for _ in range(self.n_iter_laplace_mode):
153
+ pi = 1 / (1 + torch.exp(-f))
154
+ W = pi * (1 - pi)
155
+ W_sr = torch.sqrt(W)
156
+ W_sr_K = W_sr.unsqueeze(-1) * K
157
+ B = torch.eye(len(W)) + W_sr_K * W_sr
158
+ L = torch.linalg.cholesky(B)
159
+ b = W * f + (self.Y - pi)
160
+ a = b - W_sr * torch.cholesky_solve((W_sr_K @ b).unsqueeze(-1), L).squeeze(-1)
161
+ f = K @ a
162
+ lml = -0.5 * a @ f - torch.log1p(torch.exp(-(self.Y * 2 - 1) * f)).sum() - torch.log(torch.diag(L)).sum()
163
+ if lml - log_marginal_likelihood < 1e-10:
164
+ break
165
+ log_marginal_likelihood = lml
166
+ self._f_cached = f
167
+ return log_marginal_likelihood, (pi, W_sr, L, b, a)
168
+
169
+ def _derivative(self, parameter_derivative):
170
+ K = self.prior_covariance_matrix
171
+ _, (pi, W_sr, L, b, a) = self._posterior_mode()
172
+ R = W_sr.unsqueeze(-1) * torch.cholesky_solve(torch.diag(W_sr), L)
173
+ C = torch.linalg.solve(L, W_sr.unsqueeze(-1) * K)
174
+ s_2 = -0.5 * (torch.diag(K) - torch.diag(C.T @ C)) * (pi * (1 - pi) * (1 - 2 * pi))
175
+ if parameter_derivative.ndim == 2:
176
+ C = parameter_derivative
177
+ s_1 = 0.5 * (a @ C) @ a - 0.5 * R.T.ravel() @ C.ravel()
178
+ b = C @ (self.Y - pi)
179
+ s_3 = b - K @ (R @ b)
180
+ derivative = (s_1 + s_2 @ s_3).unsqueeze(-1)
181
+ else:
182
+ d = parameter_derivative.shape[0]
183
+ a = a.view(1, -1)
184
+ s_1 = 0.5 * (a @ parameter_derivative @ a.transpose(1, 0)).squeeze()
185
+ s_1 -= 0.5 * (R.ravel() * parameter_derivative.view(d, -1)).sum(dim=1)
186
+
187
+ Y_minus_pi = (self.Y - pi).unsqueeze(0)
188
+ b = torch.matmul(parameter_derivative, Y_minus_pi.unsqueeze(-1)).squeeze(-1)
189
+ Rb = (R.T @ b.T).T
190
+ s_3 = b - (K @ Rb.T).T
191
+
192
+ s_2 = s_2.unsqueeze(0)
193
+ s_2_s_3 = (s_2 * s_3).sum(dim=1)
194
+
195
+ derivative = s_1 + s_2_s_3
196
+ return -derivative
197
+
198
+ def train_kernel(self, epochs=10, optimiser=None, callback_frequency=1, verbose=False):
199
+ """
200
+ Trains the current covariance function parameters by maximizing the log marginal likelihood.
201
+
202
+ Args:
203
+ epochs (int, optional): The number of optimisation rounds. Must be a positive integer. Defaults to 10.
204
+ optimiser (:ref:`optimisers_section_label` | None, optional): The optimiser used for training the model. If None, the Adam optimiser is used.
205
+ callback_frequency (int, optional): The number of iterations between printing info from training. Must be a positive integer. Defaults to 1, which means that every iteration, info is printed assuming verbose=True.
206
+ verbose (bool, optional): If True, prints the log marginal likelihood of the model during training. Defaults to False.
207
+
208
+ Returns:
209
+ history (dict[str, torch.Tensor], the tensor is floor(epochs / callback_frequency) long.): A dictionary tracking the evolution of the log marginal likelihood at intervals defined by callback_frequency. The tensor can be accessed with history["log marginal likelihood"].
210
+
211
+ Raises:
212
+ NotFittedError: If the GaussianProcessClassifier model has not been fitted before training the kernel.
213
+ TypeError: If the parameters are of wrong type.
214
+ ValueError: If epochs is not a positive integer.
215
+ """
216
+ if not hasattr(self, "prior_covariance_matrix"):
217
+ raise NotFittedError("GaussianProcessClassifier.fit() must be called before calculating the log marginal likelihood.")
218
+ if not isinstance(epochs, int) or epochs <= 0:
219
+ raise ValueError("epochs must be a positive integer.")
220
+ if not isinstance(optimiser, BaseOptimiser) and optimiser is not None:
221
+ raise TypeError("optimiser must be from DLL.DeepLearning.Optimisers")
222
+ if not isinstance(verbose, bool):
223
+ raise TypeError("verbose must be a boolean.")
224
+
225
+ optimiser = ADAM() if optimiser is None else optimiser
226
+ optimiser.initialise_parameters(list(self.covariance_function.parameters().values()))
227
+
228
+ history = {"log marginal likelihood": torch.zeros(floor(epochs / callback_frequency))}
229
+
230
+ for epoch in range(epochs):
231
+ # calculate the derivatives
232
+ self.covariance_function.update(self._derivative, self.X)
233
+
234
+ # update the parameters
235
+ optimiser.update_parameters()
236
+
237
+ self.prior_covariance_matrix = self._get_covariance_matrix(self.X, self.X) + (self.noise + self.epsilon) * torch.eye(len(self.X), device=self.device)
238
+ if epoch % callback_frequency == 0:
239
+ lml = self.log_marginal_likelihood().item()
240
+ history["log marginal likelihood"][int(epoch / callback_frequency)] = lml
241
+ if verbose:
242
+ params = {}
243
+ for key, param in self.covariance_function.parameters().items():
244
+ if len(param) == 1:
245
+ params[key] = round(param.item(), 3)
246
+ continue
247
+ for i, param_ in enumerate(param):
248
+ params[key + "_" + str(i + 1)] = round(param_.item(), 3)
249
+ print(f"Epoch: {epoch + 1} - Log marginal likelihood: {lml} - Parameters: {params}")
250
+
251
+ _, (self._pi, self._W_sr, self._L, _, _) = self._posterior_mode() # save necessary things for the predictions
252
+ return history
253
+
254
+ # def is_positive_definite(matrix):
255
+ # print("-----------------")
256
+ # if not torch.allclose(matrix, matrix.T):
257
+ # print(f"Matrix not symmetric: {torch.linalg.norm(matrix.T - matrix)}")
258
+ # eigenvalues = torch.linalg.eigvalsh(matrix)
259
+ # print(f"Minimum eigenvalue: {torch.min(eigenvalues).item()}")
@@ -1,11 +1,11 @@
1
1
  import torch
2
2
  from math import floor
3
+ from warnings import warn
3
4
 
4
5
  from ..Kernels import _Base
5
6
  from ....DeepLearning.Optimisers import ADAM
6
7
  from ....DeepLearning.Optimisers._BaseOptimiser import BaseOptimiser
7
8
  from ....Exceptions import NotFittedError
8
- from ....Data.Metrics import _round_dictionary
9
9
 
10
10
 
11
11
  class GaussianProcessRegressor:
@@ -16,7 +16,7 @@ class GaussianProcessRegressor:
16
16
  covariance_function (:ref:`kernel_section_label`, optional): The kernel function expressing how similar are different samples.
17
17
  noise (int | float, optional): The artificially added noise to the model. Is added as variance to each sample. Must be non-negative. Defaults to 0.
18
18
  epsilon (float, optional): Implemented similarly to noise. Makes sure the covariance matrix is positive definite and hence invertible. Must be positive. Defaults to 1e-5. If one gets a RunTimeError for a matrix not being invertible, one should increase this parameter.
19
- device (torch.device, optional): The device of all matricies. Defaults to torch.device("cpu").
19
+ device (torch.device, optional): The device of all matrices. Defaults to torch.device("cpu").
20
20
 
21
21
  Attributes:
22
22
  n_features (int): The number of features. Available after fitting.
@@ -25,7 +25,7 @@ class GaussianProcessRegressor:
25
25
  if not isinstance(covariance_function, _Base):
26
26
  raise TypeError("covariance_function must be from DLL.MachineLearning.Supervisedlearning.Kernels.")
27
27
  if not isinstance(noise, int | float) or noise < 0:
28
- raise ValueError("noise must b non-negative.")
28
+ raise ValueError("noise must be non-negative.")
29
29
  if not isinstance(epsilon, int | float) or epsilon <= 0:
30
30
  raise ValueError("epsilon must be positive.")
31
31
  if not isinstance(device, torch.device):
@@ -60,18 +60,19 @@ class GaussianProcessRegressor:
60
60
  raise ValueError("The targets must be 1 dimensional with the same number of samples as the input data")
61
61
  if len(y) < 2:
62
62
  raise ValueError("There must be atleast 2 samples.")
63
- # variance = torch.var(y)
64
- # mean = torch.mean(y)
65
- # if not torch.allclose(variance, torch.ones_like(variance)):
66
- # raise ValueError("y must have one variance. Use DLL.Data.Preprocessing.StandardScaler to scale the data.")
67
- # if not torch.allclose(mean, torch.zeros_like(mean)):
68
- # raise ValueError("y must have zero mean. Use DLL.Data.Preprocessing.StandardScaler to scale the data.")
63
+ variance = torch.var(y)
64
+ mean = torch.mean(y)
65
+ if not torch.allclose(variance, torch.ones_like(variance)):
66
+ warn("y should have one variance for optimal results. Use DLL.Data.Preprocessing.StandardScaler to scale the data.")
67
+ if not torch.allclose(mean, torch.zeros_like(mean)):
68
+ warn("y should have zero mean for optimal results. Use DLL.Data.Preprocessing.StandardScaler to scale the data.")
69
69
 
70
70
  self.n_features = X.shape[1]
71
71
  self.X = X
72
72
  self.Y = y.unsqueeze(dim=1)
73
73
  self.prior_covariance_matrix = self._get_covariance_matrix(X, X) + (self.noise + self.epsilon) * torch.eye(len(X), device=self.device)
74
- self.inverse_prior_covariance_matrix = torch.linalg.inv(self.prior_covariance_matrix)
74
+ self._L = torch.linalg.cholesky(self.prior_covariance_matrix)
75
+ self._alpha = torch.cholesky_solve(self.Y, self._L)
75
76
 
76
77
  def predict(self, X):
77
78
  """
@@ -86,7 +87,7 @@ class GaussianProcessRegressor:
86
87
  TypeError: If the input matrix is not a PyTorch tensor.
87
88
  ValueError: If the input matrix is not the correct shape.
88
89
  """
89
- if not hasattr(self, "inverse_prior_covariance_matrix"):
90
+ if not hasattr(self, "prior_covariance_matrix"):
90
91
  raise NotFittedError("GaussianProcessRegressor.fit() must be called before predicting.")
91
92
  if not isinstance(X, torch.Tensor):
92
93
  raise TypeError("The input matrix must be a PyTorch tensor.")
@@ -95,8 +96,9 @@ class GaussianProcessRegressor:
95
96
 
96
97
  k_1 = self._get_covariance_matrix(self.X, X)
97
98
  k_2 = self._get_covariance_matrix(X, X) + (self.noise + self.epsilon) * torch.eye(len(X), device=self.device)
98
- mean = k_1.T @ self.inverse_prior_covariance_matrix @ self.Y
99
- posterior_covariance = k_2 - k_1.T @ self.inverse_prior_covariance_matrix @ k_1
99
+ mean = (k_1.T @ self._alpha).squeeze(-1)
100
+ V = torch.linalg.solve_triangular(self._L, k_1, upper=False)
101
+ posterior_covariance = k_2 - V.T @ V
100
102
  return mean, posterior_covariance
101
103
 
102
104
  def log_marginal_likelihood(self):
@@ -106,13 +108,21 @@ class GaussianProcessRegressor:
106
108
  Returns:
107
109
  log marginal likelihood (float): The log marginal likelihood of the current model.
108
110
  """
109
- if not hasattr(self, "inverse_prior_covariance_matrix"):
111
+ if not hasattr(self, "prior_covariance_matrix"):
110
112
  raise NotFittedError("GaussianProcessRegressor.fit() must be called before calculating the log marginal likelihood.")
111
113
 
112
- L = torch.linalg.cholesky(self.prior_covariance_matrix)
113
- alpha = torch.cholesky_solve(self.Y, L)
114
- lml = -0.5 * self.Y.T @ alpha - torch.sum(torch.log(torch.diagonal(L))) - 0.5 * len(self.Y) * torch.log(torch.tensor(2 * torch.pi, device=self.device))
115
- return lml.item()
114
+ lml = -0.5 * self.Y.T @ self._alpha - torch.sum(torch.log(torch.diagonal(self._L))) - 0.5 * len(self.Y) * torch.log(torch.tensor(2 * torch.pi, dtype=self.Y.dtype, device=self.device))
115
+ return lml
116
+
117
+ def _derivative(self, parameter_derivative):
118
+ inner = self._alpha @ self._alpha.T - torch.cholesky_inverse(self._L)
119
+ # derivative = 0.5 * torch.trace(inner @ parameter_derivative).unsqueeze(-1)
120
+ if parameter_derivative.dim() == 2:
121
+ derivative = 0.5 * torch.trace(inner @ parameter_derivative).unsqueeze(-1)
122
+ elif parameter_derivative.dim() == 3:
123
+ derivative = 0.5 * torch.einsum("ij,kji->k", inner, parameter_derivative)
124
+ # minus sign, since goal is to maximise the log_marginal_likelihood
125
+ return -derivative
116
126
 
117
127
  def train_kernel(self, epochs=10, optimiser=None, callback_frequency=1, verbose=False):
118
128
  """
@@ -132,7 +142,7 @@ class GaussianProcessRegressor:
132
142
  TypeError: If the parameters are of wrong type.
133
143
  ValueError: If epochs is not a positive integer.
134
144
  """
135
- if not hasattr(self, "inverse_prior_covariance_matrix"):
145
+ if not hasattr(self, "prior_covariance_matrix"):
136
146
  raise NotFittedError("GaussianProcessRegressor.fit() must be called before calculating the log marginal likelihood.")
137
147
  if not isinstance(epochs, int) or epochs <= 0:
138
148
  raise ValueError("epochs must be a positive integer.")
@@ -147,29 +157,17 @@ class GaussianProcessRegressor:
147
157
  history = {"log marginal likelihood": torch.zeros(floor(epochs / callback_frequency))}
148
158
 
149
159
  for epoch in range(epochs):
150
- # form the derivative function
151
- def derivative(parameter_derivative):
152
- derivative = 0.5 * self.Y.T @ self.inverse_prior_covariance_matrix @ parameter_derivative @ self.inverse_prior_covariance_matrix @ self.Y
153
-
154
- if parameter_derivative.ndim == 2:
155
- derivative = derivative.squeeze(1)
156
- derivative -= 0.5 * torch.trace(self.inverse_prior_covariance_matrix @ parameter_derivative)
157
- else:
158
- derivative = derivative.squeeze((1, 2))
159
- derivative -= 0.5 * (self.inverse_prior_covariance_matrix @ parameter_derivative).diagonal(dim1=1, dim2=2).sum(dim=-1)
160
- # minus sign, since goal is to maximise the log_marginal_likelihood
161
- return -derivative
162
-
163
160
  # calculate the derivatives
164
- self.covariance_function.update(derivative, self.X)
161
+ self.covariance_function.update(self._derivative, self.X)
165
162
 
166
163
  # update the parameters
167
164
  optimiser.update_parameters()
168
165
 
169
166
  self.prior_covariance_matrix = self._get_covariance_matrix(self.X, self.X) + (self.noise + self.epsilon) * torch.eye(len(self.X), device=self.device)
170
- self.inverse_prior_covariance_matrix = torch.linalg.inv(self.prior_covariance_matrix)
167
+ self._L = torch.linalg.cholesky(self.prior_covariance_matrix)
168
+ self._alpha = torch.cholesky_solve(self.Y, self._L)
171
169
  if epoch % callback_frequency == 0:
172
- lml = self.log_marginal_likelihood()
170
+ lml = self.log_marginal_likelihood().item()
173
171
  history["log marginal likelihood"][int(epoch / callback_frequency)] = lml
174
172
  if verbose:
175
173
  params = {}
@@ -0,0 +1,2 @@
1
+ from ._GaussianProcessRegressor import GaussianProcessRegressor
2
+ from ._GaussianProcessClassifier import GaussianProcessClassifier
@@ -273,7 +273,7 @@ class Linear(_Base):
273
273
  self.sigma = self.sigma.to(X1.device)
274
274
  self.sigma_bias = self.sigma_bias.to(X1.device)
275
275
 
276
- return self.sigma_bias ** 2 + self.sigma ** 2 * X1 @ X2.T
276
+ return self.sigma_bias + self.sigma ** 2 * X1 @ X2.T
277
277
 
278
278
  def derivative_sigma(self, X1, X2):
279
279
  """
@@ -294,7 +294,8 @@ class Linear(_Base):
294
294
  :meta private:
295
295
  """
296
296
  if not self.train_sigma_bias: return torch.zeros((len(X1), len(X2)), dtype=X1.dtype, device=X1.device)
297
- val = (2 * self.sigma_bias).to(X1.dtype)
297
+ # val = (2 * self.sigma_bias).to(X1.dtype)
298
+ val = torch.ones((len(X1), len(X2)), dtype=X1.dtype, device=X1.device)
298
299
  # descrete = -self(X1, X2)
299
300
  # eps = 1e-6
300
301
  # self.sigma_bias += eps
pydllib-1.0.2/PKG-INFO ADDED
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyDLLib
3
+ Version: 1.0.2
4
+ Summary: A deep and machine learning library. Made for learning purposes and ease of understanding.
5
+ Author-email: Aatu Selkee <aatu.selkee@gmail.com>
6
+ Project-URL: Homepage, https://naapeli.github.io/deep-learning-library/index.html
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.11.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: cvxopt==1.3.2
14
+ Requires-Dist: filelock==3.18.0
15
+ Requires-Dist: fsspec==2025.3.0
16
+ Requires-Dist: Jinja2==3.1.6
17
+ Requires-Dist: MarkupSafe==3.0.2
18
+ Requires-Dist: mpmath==1.3.0
19
+ Requires-Dist: networkx==3.4.2
20
+ Requires-Dist: numpy==2.1.3
21
+ Requires-Dist: scipy==1.15.2
22
+ Requires-Dist: sympy==1.13.1
23
+ Requires-Dist: torch==2.6.0
24
+ Requires-Dist: typing_extensions==4.13.0
25
+ Dynamic: license-file
26
+
27
+ # DLL (Deep Learning Library)
28
+
29
+ DLL is a deep learning library inspired by TensorFlow and PyTorch. This is my largest project to date, featuring thousands of lines of code. It encompasses a wide range of deep learning and machine learning methods, and includes numerous examples and tests to demonstrate their usage. Feel free to explore the source code and experiment with the models using the documentation.
30
+
31
+ ## Documentation:
32
+
33
+ Checkout the documentation of DLL [here](https://naapeli.github.io/deep-learning-library/).
34
+
35
+ ## Installation
36
+
37
+ One can get an installation of this library by the following command:
38
+
39
+ ```
40
+ pip install PyDLLib
41
+ ```
42
+
43
+ After installation, one can use the library as described in the [documentation](https://naapeli.github.io/deep-learning-library/api/DLL.html) and in the [examples](https://naapeli.github.io/deep-learning-library/auto_examples/index.html).
44
+
45
+
46
+ ## Running Tests
47
+
48
+ To run the tests, one can clone the GitHub [repository](https://github.com/naapeli/deep-learning-library) to a local folder, navigate to the deep-learning-library-folder and use eg. the following command:
49
+
50
+ ```
51
+ python -m Tests.ReinforcementLearning.DeepReinforcementLearning
52
+ ```
53
+
54
+ Feel free to explore the code and apply it to new problems!
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyDLLib
3
+ Version: 1.0.2
4
+ Summary: A deep and machine learning library. Made for learning purposes and ease of understanding.
5
+ Author-email: Aatu Selkee <aatu.selkee@gmail.com>
6
+ Project-URL: Homepage, https://naapeli.github.io/deep-learning-library/index.html
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.11.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: cvxopt==1.3.2
14
+ Requires-Dist: filelock==3.18.0
15
+ Requires-Dist: fsspec==2025.3.0
16
+ Requires-Dist: Jinja2==3.1.6
17
+ Requires-Dist: MarkupSafe==3.0.2
18
+ Requires-Dist: mpmath==1.3.0
19
+ Requires-Dist: networkx==3.4.2
20
+ Requires-Dist: numpy==2.1.3
21
+ Requires-Dist: scipy==1.15.2
22
+ Requires-Dist: sympy==1.13.1
23
+ Requires-Dist: torch==2.6.0
24
+ Requires-Dist: typing_extensions==4.13.0
25
+ Dynamic: license-file
26
+
27
+ # DLL (Deep Learning Library)
28
+
29
+ DLL is a deep learning library inspired by TensorFlow and PyTorch. This is my largest project to date, featuring thousands of lines of code. It encompasses a wide range of deep learning and machine learning methods, and includes numerous examples and tests to demonstrate their usage. Feel free to explore the source code and experiment with the models using the documentation.
30
+
31
+ ## Documentation:
32
+
33
+ Checkout the documentation of DLL [here](https://naapeli.github.io/deep-learning-library/).
34
+
35
+ ## Installation
36
+
37
+ One can get an installation of this library by the following command:
38
+
39
+ ```
40
+ pip install PyDLLib
41
+ ```
42
+
43
+ After installation, one can use the library as described in the [documentation](https://naapeli.github.io/deep-learning-library/api/DLL.html) and in the [examples](https://naapeli.github.io/deep-learning-library/auto_examples/index.html).
44
+
45
+
46
+ ## Running Tests
47
+
48
+ To run the tests, one can clone the GitHub [repository](https://github.com/naapeli/deep-learning-library) to a local folder, navigate to the deep-learning-library-folder and use eg. the following command:
49
+
50
+ ```
51
+ python -m Tests.ReinforcementLearning.DeepReinforcementLearning
52
+ ```
53
+
54
+ Feel free to explore the code and apply it to new problems!
@@ -71,6 +71,7 @@ DLL/MachineLearning/SupervisedLearning/__init__.py
71
71
  DLL/MachineLearning/SupervisedLearning/Calibration/_CalibratedClassifier.py
72
72
  DLL/MachineLearning/SupervisedLearning/Calibration/_IsotonicRegression.py
73
73
  DLL/MachineLearning/SupervisedLearning/Calibration/__init__.py
74
+ DLL/MachineLearning/SupervisedLearning/GaussianProcesses/_GaussianProcessClassifier.py
74
75
  DLL/MachineLearning/SupervisedLearning/GaussianProcesses/_GaussianProcessRegressor.py
75
76
  DLL/MachineLearning/SupervisedLearning/GaussianProcesses/__init__.py
76
77
  DLL/MachineLearning/SupervisedLearning/LinearModels/TimeSeries.py
@@ -0,0 +1,12 @@
1
+ cvxopt==1.3.2
2
+ filelock==3.18.0
3
+ fsspec==2025.3.0
4
+ Jinja2==3.1.6
5
+ MarkupSafe==3.0.2
6
+ mpmath==1.3.0
7
+ networkx==3.4.2
8
+ numpy==2.1.3
9
+ scipy==1.15.2
10
+ sympy==1.13.1
11
+ torch==2.6.0
12
+ typing_extensions==4.13.0
@@ -6,17 +6,20 @@ DLL is a deep learning library inspired by TensorFlow and PyTorch. This is my la
6
6
 
7
7
  Checkout the documentation of DLL [here](https://naapeli.github.io/deep-learning-library/).
8
8
 
9
- ## Upcoming topics:
9
+ ## Installation
10
+
11
+ One can get an installation of this library by the following command:
12
+
13
+ ```
14
+ pip install PyDLLib
15
+ ```
16
+
17
+ After installation, one can use the library as described in the [documentation](https://naapeli.github.io/deep-learning-library/api/DLL.html) and in the [examples](https://naapeli.github.io/deep-learning-library/auto_examples/index.html).
10
18
 
11
- - embedding layer
12
- - concatenate layer
13
- - multi headed cross attention
14
- - hyperparameter tuning with grid search and random search
15
- - multiclass classification with OvO and OvR
16
19
 
17
20
  ## Running Tests
18
21
 
19
- To run the tests, navigate to the deep-learning-library-folder and use eg. the following command:
22
+ To run the tests, one can clone the GitHub [repository](https://github.com/naapeli/deep-learning-library) to a local folder, navigate to the deep-learning-library-folder and use eg. the following command:
20
23
 
21
24
  ```
22
25
  python -m Tests.ReinforcementLearning.DeepReinforcementLearning
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyDLLib"
7
- version = "1.0"
7
+ version = "1.0.2"
8
8
  authors = [
9
9
  {name = "Aatu Selkee", email = "aatu.selkee@gmail.com"},
10
10
  ]
@@ -0,0 +1,12 @@
1
+ cvxopt==1.3.2
2
+ filelock==3.18.0
3
+ fsspec==2025.3.0
4
+ Jinja2==3.1.6
5
+ MarkupSafe==3.0.2
6
+ mpmath==1.3.0
7
+ networkx==3.4.2
8
+ numpy==2.1.3
9
+ scipy==1.15.2
10
+ sympy==1.13.1
11
+ torch==2.6.0
12
+ typing_extensions==4.13.0
@@ -1 +0,0 @@
1
- from ._GaussianProcessRegressor import GaussianProcessRegressor