Skip to content

Commit

Permalink
Merge branch 'master' into feature/844-cross
Browse files Browse the repository at this point in the history
  • Loading branch information
mtar authored Jan 10, 2022
2 parents fa643da + bc74848 commit 88038d1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- [#867](https://github.com/helmholtz-analytics/heat/pull/867) Upgraded to support torch 1.9.0
- [#876](https://github.com/helmholtz-analytics/heat/pull/876) Make examples work (Lasso and kNN)
- [#894](https://github.com/helmholtz-analytics/heat/pull/894) Change inclusion of license file
- [#884](https://github.com/helmholtz-analytics/heat/pull/884) Added capabilities for PyTorch 1.10.0, this is now the recommended version to use.

## Bug Fixes
Expand Down
12 changes: 7 additions & 5 deletions examples/classification/demo_knn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
import os
import random

# Fix python path if run from terminal
curdir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.abspath(os.path.join(curdir, "../../")))

import heat as ht
from heat.classification.kneighborsclassifier import KNeighborsClassifier

import pkg_resources

# Load dataset from hdf5 file
X = ht.load_hdf5("../../heat/datasets/iris.h5", dataset="data", split=0)
iris_path = pkg_resources.resource_filename(
pkg_resources.Requirement.parse("heat"), "heat/datasets/iris.h5"
)

X = ht.load_hdf5(iris_path, dataset="data", split=0)

# Generate keys for the iris.h5 dataset
keys = []
Expand Down
15 changes: 9 additions & 6 deletions examples/lasso/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
import sys
import os

# Fix python path if run from terminal
curdir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.abspath(os.path.join(curdir, "../../")))

import heat as ht
from matplotlib import pyplot as plt
from sklearn import datasets
import heat.regression.lasso as lasso

import plotfkt

import pkg_resources

# read scikit diabetes data set
diabetes = datasets.load_diabetes()

# load diabetes dataset from hdf5 file
X = ht.load_hdf5("../../heat/datasets/diabetes.h5", dataset="x", split=0)
y = ht.load_hdf5("../../heat/datasets/diabetes.h5", dataset="y", split=0)
diabetes_path = pkg_resources.resource_filename(
pkg_resources.Requirement.parse("heat"), "heat/datasets/diabetes.h5"
)

X = ht.load_hdf5(diabetes_path, dataset="x", split=0)
y = ht.load_hdf5(diabetes_path, dataset="y", split=0)

# normalize dataset #DoTO this goes into the lasso fit routine soon as issue #106 is solved
X = X / ht.sqrt((ht.mean(X ** 2, axis=0)))
Expand Down
3 changes: 3 additions & 0 deletions heat/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Make heat.datasets available as a module.
"""
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup(
name="heat",
packages=find_packages(exclude=("*tests*", "*benchmarks*")),
data_files=["README.md", "LICENSE"],
package_data={"heat.datasets": ["*.csv", "*.h5", "*.nc"]},
version=__version__,
description="A framework for high-performance data analytics and machine learning.",
long_description=long_description,
Expand Down

0 comments on commit 88038d1

Please sign in to comment.