-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #324 create table from state space results - work in progress * tests TBA * first commit * #324 create table from state space results - with tests * Trimmed SD not implemented * #324 Trimmed SD implemented * #324 report window size to HTML * #324 WIP - needs refinement, but works for non-test. Test may blow graph generation. * #328 multiplot added as option
- Loading branch information
1 parent
02f464c
commit 87412ef
Showing
21 changed files
with
796 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[run] | ||
omit = tests/* | ||
omit = algorithms/* test* utils/* vanv/* vvcode/* support.py __init__.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
python pygrams.py -ts -ei gradients -nts 5 -mpq 50 -sma kalman -dt 2018/05/31 -tsdf 2012/06/01 -tsdt 2016/06/01 --test -pns 1 2 3 4 5 6 -dh publication_date -ds USPTO-granted-lite-all.pkl.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,24 @@ | ||
# import csv | ||
# import os | ||
# import rpy2.robjects as robjects | ||
# | ||
# | ||
# class StateSpaceModel(object): | ||
# | ||
# def __init__(self, data_in, num_prediction_periods): | ||
# if not all(isinstance(x, float) for x in data_in): | ||
# raise ValueError('Time series must be all float values') | ||
# | ||
# self.__history = data_in | ||
# self.__num_prediction_periods = num_prediction_periods | ||
# | ||
# @property | ||
# def configuration(self): | ||
# return None | ||
# | ||
# def predict_counts(self): | ||
# cwd = os.getcwd() | ||
# rwd = robjects.r('getwd()') | ||
# | ||
# if '/scripts/algorithms/code' not in rwd[0]: | ||
# wd = '''setwd(''' + '\'' + cwd + '''/scripts/algorithms/code')''' | ||
# robjects.r(wd) | ||
# rwd = robjects.r('getwd()') | ||
# output_path = rwd[0] + '/buffer.csv' | ||
# print("path: "+output_path) | ||
# | ||
# with open(output_path, "w") as file: | ||
# writer = csv.writer(file, delimiter='\n') | ||
# writer.writerow(self.__history) | ||
# | ||
# robjects.r(''' | ||
# source('predict') | ||
# ''') | ||
# | ||
# r_func = robjects.globalenv['predict'] | ||
# out = r_func("buffer.csv",self.__num_prediction_periods) | ||
# os.chdir(cwd) | ||
# return out[0] | ||
import numpy as np | ||
|
||
from scripts.algorithms.code.ssm import StateSpaceModel | ||
|
||
|
||
class StateSpaceModelObject(object): | ||
|
||
def __init__(self, data_in, num_prediction_periods): | ||
if not all(isinstance(x, float) for x in data_in): | ||
raise ValueError('Time series must be all float values') | ||
|
||
self.__history = data_in | ||
self.__num_prediction_periods = num_prediction_periods | ||
|
||
self.__alpha, self.__mse = StateSpaceModel(self.__history).run_smooth_forecast(k=self.__num_prediction_periods) | ||
@property | ||
def configuration(self): | ||
return None | ||
|
||
def predict_counts(self): | ||
return np.array(self.__alpha[0])[0] | ||
|
||
def predict_derivatives(self): | ||
return np.array(self.__alpha[1])[0] |
Oops, something went wrong.