|
|
@@ -0,0 +1,227 @@
|
|
|
+{
|
|
|
+ "cells": [
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 1,
|
|
|
+ "id": "b9b5254c",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "name": "stderr",
|
|
|
+ "output_type": "stream",
|
|
|
+ "text": [
|
|
|
+ "2022-11-15 15:58:02.929210: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory\n",
|
|
|
+ "2022-11-15 15:58:02.929250: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.\n"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "from library.analysis import loadDataset, testSets\n",
|
|
|
+ "from library.generators.XConvGeN import XConvGeN\n",
|
|
|
+ "#from library.timing import timing\n",
|
|
|
+ "from fdc.fdc import FDC\n",
|
|
|
+ "#from matplotlib import pyplot as plt\n",
|
|
|
+ "#import numpy as np\n",
|
|
|
+ "#import tensorflow as tf"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 2,
|
|
|
+ "id": "6bfec0a2",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "name": "stdout",
|
|
|
+ "output_type": "stream",
|
|
|
+ "text": [
|
|
|
+ "Load 'folding_abalone_17_vs_7_8_9_10'\n",
|
|
|
+ "from pickle file\n",
|
|
|
+ "Data loaded.\n"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "data = loadDataset(testSets[0])"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 3,
|
|
|
+ "id": "6d686da5",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "name": "stdout",
|
|
|
+ "output_type": "stream",
|
|
|
+ "text": [
|
|
|
+ "(2338, 2280, 58)\n"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "print((len(data.data), len(data.data0), len(data.data1)))"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 4,
|
|
|
+ "id": "9e3e3806",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "fdc = FDC()\n",
|
|
|
+ "fdc.nom_list = [0]\n",
|
|
|
+ "fdc.cont_list = list(range(data.data0.shape[1]))[1:]"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 5,
|
|
|
+ "id": "01d71d6a",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "gen = XConvGeN(data.data0.shape[1], neb=5, fdc=fdc)"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 6,
|
|
|
+ "id": "ad01be2b",
|
|
|
+ "metadata": {
|
|
|
+ "scrolled": false
|
|
|
+ },
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "name": "stderr",
|
|
|
+ "output_type": "stream",
|
|
|
+ "text": [
|
|
|
+ "2022-11-15 15:58:11.721013: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory\n",
|
|
|
+ "2022-11-15 15:58:11.721066: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)\n",
|
|
|
+ "2022-11-15 15:58:11.721100: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (efdcb09fb24e): /proc/driver/nvidia/version does not exist\n",
|
|
|
+ "2022-11-15 15:58:11.722233: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA\n",
|
|
|
+ "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "gen.reset(data.data1)"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "4698522c",
|
|
|
+ "metadata": {
|
|
|
+ "scrolled": false
|
|
|
+ },
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "name": "stdout",
|
|
|
+ "output_type": "stream",
|
|
|
+ "text": [
|
|
|
+ "FDC.normalize (init): 0.00009 / 0.000s\n",
|
|
|
+ "|data| = (58, 8)\n",
|
|
|
+ "umap with metric 'euclidean'\n",
|
|
|
+ "|part| = (58, 7)\n",
|
|
|
+ "|emb_A| = (58, 2)\n",
|
|
|
+ "|emb_A| = (58, 2)\n",
|
|
|
+ "FDC.normalize (clustering CONT): 7.36561 / 7.366s\n",
|
|
|
+ "FDC.normalize (clustering ORD): 0.00006 / 7.366s\n",
|
|
|
+ "umap with metric 'hamming'\n",
|
|
|
+ "|part| = (58, 1)\n",
|
|
|
+ "|emb_A| = (58, 1)\n",
|
|
|
+ "|emb_A| = (58, 1)\n",
|
|
|
+ "FDC.normalize (clustering NOM): 1.47620 / 8.842s\n",
|
|
|
+ "FDC.normalize (concat): 0.00008 / 8.842s\n",
|
|
|
+ "|fdc| = (58, 3)\n",
|
|
|
+ "FDC.normalize (total): 0.00002 / 8.842s\n",
|
|
|
+ "|N| = (58, 3)\n",
|
|
|
+ "|D| = (58, 8)\n",
|
|
|
+ "[==========] [====== ] [====== ]\r"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "gen.train(data.data1)"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "cda17654",
|
|
|
+ "metadata": {
|
|
|
+ "scrolled": false
|
|
|
+ },
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "syntheticPoints = gen.generateData(10)"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "41853bd3",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "syntheticPoints"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "da5ebdb9",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "data.data1[:5]"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "4043256c",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "import math\n",
|
|
|
+ "for p in syntheticPoints:\n",
|
|
|
+ " print(min([math.sqrt(sum(y*y)) for y in (data.data1 - p) ]))"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "3bcc8cb7",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
+ "source": [
|
|
|
+ "v = gen.predictReal(data.data1)\n",
|
|
|
+ "(min(v), max(v), sum(v) / len(v))"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "metadata": {
|
|
|
+ "kernelspec": {
|
|
|
+ "display_name": "Python 3 (ipykernel)",
|
|
|
+ "language": "python",
|
|
|
+ "name": "python3"
|
|
|
+ },
|
|
|
+ "language_info": {
|
|
|
+ "codemirror_mode": {
|
|
|
+ "name": "ipython",
|
|
|
+ "version": 3
|
|
|
+ },
|
|
|
+ "file_extension": ".py",
|
|
|
+ "mimetype": "text/x-python",
|
|
|
+ "name": "python",
|
|
|
+ "nbconvert_exporter": "python",
|
|
|
+ "pygments_lexer": "ipython3",
|
|
|
+ "version": "3.8.15"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "nbformat": 4,
|
|
|
+ "nbformat_minor": 5
|
|
|
+}
|