Compare commits

..

22 Commits
gp ... master

Author SHA1 Message Date
4580f67920 cli autocomplete and defered imports 2023-01-17 23:18:26 +01:00
2f2da60626 Fix curiosity tanh bug 2022-11-30 17:44:12 +01:00
73c7e5e6c2 Syntax Bug fixed 2022-11-19 16:35:04 +01:00
e45423aaa4 Dont show score for tags 2022-11-19 16:28:06 +01:00
9a473edfdc Allow configurable curiosity and bug fixes 2022-11-19 16:18:58 +01:00
1c34d2876f New feature: Dissonance 2022-09-11 18:56:47 +02:00
6af38c686f Updated requirements.txt 2022-07-01 12:19:41 +02:00
5ef60d340e Made README domain independent 2022-06-19 15:18:40 +02:00
29b5959623 Added .idea to .gitignore 2022-06-16 20:31:13 +02:00
4f116bc8bf Remove calice-score from read books 2022-03-20 18:11:56 +01:00
6ebe7d03fc Reduced Calice Score to only 6 digits 2022-03-19 12:21:48 +01:00
8e8592bb29 Added Calice Score; Renamed Calice to Calice Rating 2022-03-19 12:18:14 +01:00
f9c70a8ee4 Fixed bugs in createCaliceColumn 2022-03-19 11:42:27 +01:00
0f35ae691e Info about half-stars added 2022-03-19 11:39:10 +01:00
9193e6b3e6 New command to add calice-column (no half-stars yet) 2022-03-19 11:37:24 +01:00
63895953c0 Allow inserting scores into calibreDB 2022-03-19 11:35:30 +01:00
ac6d85fa99 Enabled Imgs per default; Chrome recommendet 2022-03-08 14:21:36 +01:00
44c0c189d7 Better recommender scores 2022-03-07 13:51:26 +01:00
b75ede5d89 Added a default toggle for --imgs / --no-imgs 2022-03-07 13:26:29 +01:00
84deaa2f64 Better training and reenabled median 2022-03-07 13:21:16 +01:00
26527e83c3 Ignore all neuralWeights endings 2022-02-25 00:46:44 +01:00
2642423289 Revert "implemented neuralBins (performance is bad...)"
This reverts commit bd53a83058.
2022-02-24 20:19:00 +01:00
5 changed files with 522 additions and 279 deletions

3
.gitignore vendored
View File

@ -2,5 +2,6 @@ __pycache__
*.html
.venv
neuralWeights.json
neuralWeights.json.bak
neuralWeights.json.*
.imgLinkCache.json
.idea

View File

@ -1,4 +1,4 @@
# CaliGraph
CaliGraph connects to the database of your local Calibre-Instance in order to recommend which unread books are likely to be enjoyed. The recommendations are displayed in a graph which explains the recommendation by showing correlations to previously read books, authors, recommendations by same individuals, tags...
![Screenshot](https://gitea.dominik.roth.ml/dodox/CaliGraph/raw/branch/master/Screenshot_README.png)
![Screenshot](./Screenshot_README.png)

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +0,0 @@
import numpy as np
from node2vec import Node2Vec
from sklearn.gaussian_process.kernels import Kernel, Hyperparameter
from sklearn.gaussian_process.kernels import GenericKernelMixin
from sklearn.gaussian_process import GaussianProcessRegressor
#from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.base import clone
class BookKernel(GenericKernelMixin, Kernel):
def __init__(self, wv):
self.wv = wv
def _f(self, s1, s2):
"""
kernel value between a pair of sequences
"""
s = self.wv.similarity(s1, s2)**2*0.99 + 0.01
if s <= 0:
print('bad!')
return s
def __call__(self, X, Y=None, eval_gradient=False):
if Y is None:
Y = X
if eval_gradient:
return (
np.array([[self._f(x, y) for y in Y] for x in X])
)
else:
return np.array([[self._f(x, y) for y in Y] for x in X])
#return np.array(self.wv.n_similarity(X, Y))
def diag(self, X):
return self(X)
def is_stationary(self):
return False
def clone_with_theta(self, theta):
cloned = clone(self)
cloned.theta = theta
return cloned
def genGprScores(G, scoreName='gpr_score', stdName='gpr_std'):
print('[\] Constructing Feature-Space-Projector')
node2vec = Node2Vec(G, dimensions=32, walk_length=16, num_walks=128, workers=8)
print('[\] Fitting Embeddings for Kernel')
model = node2vec.fit(window=8, min_count=1, batch_words=4)
wv = model.wv
print('[\] Constructing Kernel')
kernel = BookKernel(wv)
print('[\] Fitting GP')
X, y = [], []
for n in G.nodes:
node = G.nodes[n]
if 'rating' in node and node['rating']!=None:
X.append(n)
y.append(node['rating'])
gpr = GaussianProcessRegressor(kernel=kernel, random_state=3141, alpha=1e-8).fit(X, y)
print('[\] Inferencing GP')
X = []
for n in G.nodes:
node = G.nodes[n]
if not 'rating' in node or node['rating']==None:
X.append(n)
y, stds = gpr.predict(X, return_std=True)
i=0
for n in G.nodes:
node = G.nodes[n]
if not 'rating' in node or node['rating']==None:
s, std = y[i], stds[i][i][0]
i+=1
node[scoreName], node[stdName] = float(s), float(std)

View File

@ -6,3 +6,9 @@ pyvis
fuzzywuzzy
rake_nltk
ptpython
requests
pandas
plotly
wikipedia
argcomplete
pyzshcomplete