This file contains hidden or 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 tensorflow as tf | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| x_label0 = np.random.normal(5,1,10) | |
| x_label1 = np.random.normal(2,1,10) | |
| xs = np.append(x_label0, x_label1) | |
| labels = [0.] * len(x_label0) + [1.] * len(x_label1) |
This file contains hidden or 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 tensorflow as tf | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| learning_rate = 0.001 | |
| training_epochs = 1000 | |
| reg_lambda = 0. | |
| x_dataset = np.linspace(-1, 1, 100) | |
| num_coeffs = 9 |
This file contains hidden or 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 | |
| from __future__ import division | |
| from __future__ import print_function | |
| import os.path | |
| import re | |
| import sys | |
| import numpy as np | |
| import tensorflow as tf |
This file contains hidden or 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
| private void setContent(){ | |
| String tag = ""; | |
| int i; | |
| for(i = 0 ; i <mTagLists.size(); i++){ | |
| tag += "#" + mTagLists.get(i) + " "; | |
| } | |
| ArrayList<int[]> hashtagSpans = getSpans(tag, '#'); | |
| SpannableString tagsContent = new SpannableString(tag); |
This file contains hidden or 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
| public class Hashtag extends ClickableSpan { | |
| public interface ClickEventListener{ | |
| void onClickEvent(String data); | |
| } | |
| private ClickEventListener mClickEventListener = null; | |
| private Context context; | |
| private TextPaint textPaint; |
This file contains hidden or 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
| public class CircleTransform implements Transformation { | |
| @Override | |
| public Bitmap transform(Bitmap source) { | |
| int size = Math.min(source.getWidth(), source.getHeight()); | |
| int x = (source.getWidth() - size) / 2; | |
| int y = (source.getHeight() - size) / 2; | |
| Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size); |
This file contains hidden or 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
| private CallbackManager mCallbackManager; | |
| private AccessToken mToken = null; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState){ | |
| super.onCreate(savedInstanceState); | |
| FacebokSdk.sdkInitialize(getApplicationContext()); | |
| mCallbackManager = CallbackManager.Factory.create(); | |
| mToken = AccessToken.getCurrentAccessToken(); | |
This file contains hidden or 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 os,sys | |
| import Image | |
| size = 256, 256 | |
| for (path, dirname,files) in os.walk(sys.argv[1]): | |
| for f in files: | |
| ext = os.path.splitext(f) | |
| upper_ext = ext[1].upper() | |
| outfile = os.path.join(path, '/root/output', ext[0] + '_256x256' + upper_ext) |
This file contains hidden or 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 tensorflow as tf | |
| import sys | |
| sys.path.append("/root/work/deep/code/01_mnist_beginning") | |
| import input_data | |
| import numpy | |
| import math | |
| import time | |
| NUM_CLASSES = 10 | |
| IMAGE_SIZE = 28 |
This file contains hidden or 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 createDataSet(): | |
| dataSet = [[1,1,'yes'], [1,1,'yes'], [1,0,'no'], [0,1,'no'], [0,1,'no']] | |
| labels = ['no surfacing', 'flippers'] | |
| return dataSet, labels | |
| def majorityCnt(classList): | |
| classCount={} | |
| for vote in classList: | |
| if vote not in classCount.keys(): | |
| classCount[vote] = 0 |