psyke 0.8.2.dev3__py3-none-any.whl → 0.8.2.dev8__py3-none-any.whl

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.

Potentially problematic release.


This version of psyke might be problematic. Click here for more details.

@@ -1,8 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from abc import ABC
4
- from itertools import groupby
5
- from typing import Iterable
6
4
  import numpy as np
7
5
  import pandas as pd
8
6
  from sklearn.base import ClassifierMixin
@@ -16,7 +14,7 @@ from psyke.extraction.hypercubic.hypercube import HyperCube, RegressionCube, Cla
16
14
  GenericCube
17
15
  from psyke.hypercubepredictor import HyperCubePredictor
18
16
  from psyke.schema import Between, Outside, Value
19
- from psyke.utils.logic import create_variable_list, create_head, to_var, Simplifier, last_in_body, PRECISION
17
+ from psyke.utils.logic import create_variable_list, create_head, to_var, Simplifier
20
18
  from psyke.utils import Target
21
19
  from psyke.extraction.hypercubic.strategy import Strategy, FixedStrategy
22
20
 
@@ -415,8 +415,8 @@ class HyperCube:
415
415
 
416
416
 
417
417
  class RegressionCube(HyperCube):
418
- def __init__(self, dimension: dict[str, tuple] = None, output=LinearRegression()):
419
- super().__init__(dimension=dimension, output=output)
418
+ def __init__(self, dimension: dict[str, tuple] = None, output=None):
419
+ super().__init__(dimension=dimension, output=LinearRegression() if output is None else output)
420
420
 
421
421
  def update(self, dataset: pd.DataFrame, predictor) -> None:
422
422
  filtered = self.filter_dataframe(dataset.iloc[:, :-1])
@@ -428,7 +428,13 @@ class RegressionCube(HyperCube):
428
428
  self._barycenter = Point(means.index.values, means.values)
429
429
 
430
430
  def copy(self) -> RegressionCube:
431
- return RegressionCube(self.dimensions.copy(), output=self._output)
431
+ output = LinearRegression()
432
+ try:
433
+ output.coef_ = self.output.coef_.copy()
434
+ output.intercept_ = self.output.intercept_
435
+ except AttributeError:
436
+ pass
437
+ return RegressionCube(self.dimensions.copy(), output=output)
432
438
 
433
439
  def body(self, variables: dict[str, Var], ignore: list[str], unscale=None, normalization=None) -> Iterable[Struct]:
434
440
  intercept = self.output.intercept_ if normalization is None else unscale(sum(
@@ -489,11 +495,17 @@ class ClosedCube(HyperCube):
489
495
 
490
496
 
491
497
  class ClosedRegressionCube(ClosedCube, RegressionCube):
492
- def __init__(self, dimension: dict[str, tuple] = None, output: LinearRegression = LinearRegression()):
493
- super().__init__(dimension=dimension, output=output)
498
+ def __init__(self, dimension: dict[str, tuple] = None, output=None):
499
+ super().__init__(dimension=dimension, output=LinearRegression() if output is None else output)
494
500
 
495
501
  def copy(self) -> ClosedRegressionCube:
496
- return ClosedRegressionCube(self.dimensions.copy(), output=self._output)
502
+ output = LinearRegression()
503
+ try:
504
+ output.coef_ = self.output.coef_.copy()
505
+ output.intercept_ = self.output.intercept_
506
+ except AttributeError:
507
+ pass
508
+ return ClosedRegressionCube(self.dimensions.copy(), output=output)
497
509
 
498
510
 
499
511
  class ClosedClassificationCube(ClosedCube, ClassificationCube):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: psyke
3
- Version: 0.8.2.dev3
3
+ Version: 0.8.2.dev8
4
4
  Summary: Python-based implementation of PSyKE, i.e. a Platform for Symbolic Knowledge Extraction
5
5
  Home-page: https://github.com/psykei/psyke-python
6
6
  Author: Matteo Magnini
@@ -7,8 +7,8 @@ psyke/clustering/exact/__init__.py,sha256=GpMGOcN2bGn3wfaUKOdis3vnLEtAx9j886qsk-
7
7
  psyke/extraction/__init__.py,sha256=ziZ8T9eAOZjKipepE5_j1zfZgyFPONjW8MGERSk83nI,743
8
8
  psyke/extraction/cart/__init__.py,sha256=s8tr7jPhONgF0pfetHieFax2MD8cy6ddOS7dRWzZLjc,3579
9
9
  psyke/extraction/cart/predictor.py,sha256=2-2mv5fI0lTwwfTaEonxKh0ZUdhxuIEE6OP_rJxgmqc,3019
10
- psyke/extraction/hypercubic/__init__.py,sha256=ELY0a7MrZgUvzDORm_GbnvfbviDpCwZlXFHrQw-g_Lk,10451
11
- psyke/extraction/hypercubic/hypercube.py,sha256=Uqrpm3jB4UngLJlotzeQExoDRcgi3l3Ur3KyCVgjuDE,22322
10
+ psyke/extraction/hypercubic/__init__.py,sha256=4RZkE5uLpLGUSY6G7cmwwEx1PC1cAaGZhM_HSwzlmOw,10368
11
+ psyke/extraction/hypercubic/hypercube.py,sha256=vYJoIEAsiIY5koh84hnSdd72PPc-7-RP_1Eo5vvjxk4,22754
12
12
  psyke/extraction/hypercubic/strategy.py,sha256=X-roIsfcpJyMdo2px5JtbhP7-XE-zUNkaEK7XGXoWA8,1636
13
13
  psyke/extraction/hypercubic/utils.py,sha256=D2FN5CCm_T3h23DmLFoTnIcFo7LvIq__ktl4hjUqkcA,1525
14
14
  psyke/extraction/hypercubic/cosmik/__init__.py,sha256=XQUvOtMFpR0vMHYtwIVl3G626HMqN8Clt6BqNm4nvFs,1880
@@ -33,8 +33,8 @@ psyke/utils/logic.py,sha256=7bbW6qcKof5PlqoQ0n5Kt3Obcot-KqGAvpE8rMXvEPE,12419
33
33
  psyke/utils/metrics.py,sha256=Oo5BOonOSfo0qYsXWT5dmypZ7jiStByFC2MKEU0uMHg,2250
34
34
  psyke/utils/plot.py,sha256=dE8JJ6tQ0Ezosid-r2jqAisREjFe5LqExRzsVi5Ns-c,7785
35
35
  psyke/utils/sorted.py,sha256=C3CPW2JisND30BRk5c1sAAHs3Lb_wsRB2qZrYFuRnfM,678
36
- psyke-0.8.2.dev3.dist-info/LICENSE,sha256=KP9K6Hgezf_xdMFW7ORyKz9uA8Y8k52YJn292wcP-_E,11354
37
- psyke-0.8.2.dev3.dist-info/METADATA,sha256=j9xt5m18B6c47PK4_jysS3QfpU8pki4hYfaKJ16Gyc4,8107
38
- psyke-0.8.2.dev3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
39
- psyke-0.8.2.dev3.dist-info/top_level.txt,sha256=q1HglxOqqoIRukFtyis_ZNHczZg4gANRUPWkD7HAUTU,6
40
- psyke-0.8.2.dev3.dist-info/RECORD,,
36
+ psyke-0.8.2.dev8.dist-info/LICENSE,sha256=KP9K6Hgezf_xdMFW7ORyKz9uA8Y8k52YJn292wcP-_E,11354
37
+ psyke-0.8.2.dev8.dist-info/METADATA,sha256=Hb7rgFJQJ1JAQ0st4hyOfyFGYPN0xA5SHvggws2C-ik,8107
38
+ psyke-0.8.2.dev8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
39
+ psyke-0.8.2.dev8.dist-info/top_level.txt,sha256=q1HglxOqqoIRukFtyis_ZNHczZg4gANRUPWkD7HAUTU,6
40
+ psyke-0.8.2.dev8.dist-info/RECORD,,