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 | |
n_bit = 4 | |
xf= np.array([0.1,0.2,1.2,3,2.1,-2.1,-3.5]) | |
xf= np.array([15,25,35,40,50, 60, 70]) | |
range_xf=np.max(xf)-np.min(xf) | |
print('range:{}'.format(range_xf)) | |
alpha = (2**(n_bit-0)-1)/(range_xf) | |
print('alpha:{}'.format(alpha)) | |
zp=np.round(np.min(xf)*alpha) |
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 | |
n_bit = 4 | |
xf= np.array([0.1,0.2,1.2,3,2.1,-2.1,-3.5]) | |
xf= np.array([15,25,35,40,50, 60, 70]) | |
range_xf=np.max(np.abs(xf)) | |
print('range:{}'.format(range_xf)) | |
alpha = (2**(n_bit-1)-1)/(range_xf) | |
print('alpha:{}'.format(alpha)) | |
xq=np.round(alpha*xf) | |
print('xq:{}'.format(xq)) |
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
# -*- coding: utf-8 -*- | |
""" | |
@author: Chih-Sheng Huang (Tommy), chih.sheng.huang821@gmail.com | |
""" | |
import torch | |
import torch.nn as nn | |
import torch.utils.data as Data | |
import matplotlib.pyplot as plt | |
import numpy as np |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Mon Nov 26 21:38:26 2018 | |
reference : https://github.com/conordewey3/Medium-Stats-Analysis/blob/master/Medium%20Stats%20Data%20Collection.ipynb | |
@author: Tommy | |
""" | |
# Imports | |
from selenium import webdriver | |
import time | |
from bs4 import BeautifulSoup |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Thu May 31 11:21:44 2018 | |
Machine learning Example for「SMS Spam Collection Dataset」 | |
Database Link: | |
https://archive.ics.uci.edu/ml/datasets/sms+spam+collection | |
https://www.kaggle.com/uciml/sms-spam-collection-dataset#spam.csv | |
@author: Tommy Huang, chih.sheng.huang821@gmail.com | |
""" |