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
'use strict'; | |
/* Google Calendar API Module */ | |
angular.module('myApp.calendar', []). | |
value('resp', { | |
nullMethod: function() { | |
return 'value'; | |
}, | |
handleClientLoad: function() { |
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
import numpy as np | |
import pandas as pd | |
from math import sqrt | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Activation | |
from sklearn.feature_selection import VarianceThreshold | |
from sklearn.preprocessing import StandardScaler |
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
#data preparation | |
import pandas as pd | |
import numpy as np | |
from os import listdir | |
from os.path import isfile, join | |
#training file folder (All your csv data files) | |
file_path = 'CAX_Train' |
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
import pandas as pd | |
import numpy as np | |
from math import sqrt | |
from sklearn.metrics import mean_squared_error | |
from sklearn.ensemble import RandomForestRegressor | |
from sklearn.preprocessing import StandardScaler |
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
import pprint | |
import collections | |
H1 = [1, 2, 3, 4, 5] | |
H2 = [1, 2, 3, 4, 5] | |
all_dist = [] | |
#http://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-nested-dictionaries-in-python?noredirect=1&lq=1 | |
class AutoVivification(dict): | |
"""Implementation of perl's autovivification feature.""" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
max_iteration_count = 10 | |
it = 0 | |
error = 99 | |
tol = 0.001 | |
# intialize source trustworthiness structure | |
source_trustworthiness = {k: -np.log(1 - 0.9) for k in data['source'].unique()} |
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
while error > tol and it < max_iteration_count: | |
source_trustworthiness_old = copy.deepcopy(source_trustworthiness) | |
# 1. Compute fact confidence score | |
data = compute_confidence(data, objects, source_trustworthiness, attribute_key) | |
# 2. Compute source trustworthiness score | |
source_trustworthiness = compute_source_trust(data, source_trustworthiness) | |
# Check convergence of the process |
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
def compute_confidence(df, objects, source_trust, attribute_key): | |
# compute claims confidence score | |
all_objects_data = pd.DataFrame() | |
for obj in objects: | |
data = df[df['object'] == obj] | |
# Sub-step 1. compute from source trust | |
data, confidence = compute_confidence_score(data, source_trust, attribute_key) |
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
def compute_confidence_score(data, source_trust, attribute_key): | |
''' | |
compute the confidence score using the sources trust worthiness, sum the scores for all sources | |
for a specific claim. | |
''' | |
# loop through each source for a book | |
for idx, claim in data.iterrows(): | |
# get all sources for a specific claim | |
sources = get_sources_for_claim(data, claim, attribute_key) | |
# sum the trust score for all the sources for a specific claim |
OlderNewer