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
# 匯入各種第三方函式庫(Library) | |
library(clusterProfiler) | |
library(dplyr) | |
library(enrichplot) | |
library(org.Hs.eg.db) | |
library(msigdbr) | |
library(DOSE) | |
library(rlang) | |
library(export) | |
--------------------------------------------------------------- |
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
class Solution: | |
def twoSum(self, nums: List[int], target: int) -> List[int]: | |
dic = {} | |
for i, num in enumerate(nums): | |
if target - num in dic: | |
return([dic[target - num], i]) | |
dic[num] = i | |
return([]) |
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
from __future__ import absolute_import, division, print_function, unicode_literals | |
# TensorFlow and tf.keras | |
import tensorflow as tf | |
from tensorflow import keras | |
# import matplotlib.pyplot as plt | |
print(tf.__version__) |
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
#%% GPU Device Detection | |
from tensorflow.python.client import device_lib | |
print(device_lib.list_local_devices()) |
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
from sklearn import manifold, datasets | |
digits = datasets.load_digits(n_class=6) | |
X, y = digits.data, digits.target | |
X_tsne = manifold.TSNE(n_components=2, init='random', random_state=5, verbose=1).fit_transform(X) |
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 matplotlib.pyplot as plt | |
from sklearn import manifold, datasets | |
#Prepare the data | |
digits = datasets.load_digits(n_class=6) | |
X, y = digits.data, digits.target | |
n_samples, n_features = X.shape | |
n = 20 | |
img = np.zeros((10 * n, 10 * n)) | |
for i in range(n): |
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
from wordpress_xmlrpc import Client, WordPressPost | |
from wordpress_xmlrpc.methods.users import GetUserInfo | |
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost | |
#網站登入資訊 | |
id="你的後台登入帳號" | |
password="你的後台登入密碼" | |
#網站網址,請把example.com替換成你的網址,並且先試著連上該網址,應該會出現「XML-RPC server accepts POST requests only.」才對。 | |
url="https://example.com/xmlrpc.php" |
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
width=28 | |
height=28 | |
channels=1 | |
noise_plot = np.random.normal(0, 1, (16, 10)) | |
shape = (width, height, channels) | |
optimizer = Adam(lr=0.0002, beta_1=0.5, decay=8e-8) | |
G = generator() |
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 stacked_generator_discriminator(G,D): | |
D.trainable = False | |
model = Sequential() | |
model.add(G) | |
model.add(D) | |
return model | |
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 discriminator(): | |
""" Declare discriminator """ | |
model = Sequential() | |
model.add(Flatten(input_shape=shape)) | |
model.add(Dense((width * height * channels), input_shape=shape)) | |
model.add(LeakyReLU(alpha=0.2)) | |
model.add(Dense(int((width * height * channels)/2))) | |
model.add(LeakyReLU(alpha=0.2)) | |
model.add(Dense(1, activation='sigmoid')) |
NewerOlder