import inspect lines = inspect.getsource(magic_function) print(lines) … [Read more...] about How to get the Python source codelines?
Here is the task: An experimental drug was tested on individuals from 13 to 100. The trail had 2100 participants. Half were under 65 years old, half were over 65 years old. 95% of patients 65 or older experianced no side effects. 95% of patients under 65 experianced no side effects. import numpy as np from random import randint mport keras from keras import backend as … [Read more...] about Experiment in TensorFlow
What would be the "Hello World" problem in Ai? Some would say this would be Spam Filtering using Naive Bayesian Classifier, but many would take the MNIST dataset representing the model containing 60.000 different ciphers 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. This is also known as the MNIST dataset classification problem. To work on this problem using TensorFlow it would be enough … [Read more...] about Hello world in ai
NumPy is the fundamental package for scientific computing with Python. It contains among other things: a powerful N-dimensional array object; import numpy as np T = np.array([ [[1,2,3], [4,5,6], [7,8,9]], [[11,12,13], [14,15,16], [17,18,19]], [[21,22,23], [24,25,26], [27,28,29]], ]) print(T.shape) # (3,3,3) print(T.ndim) # 3 print(T.size) # 27 print(T) Each … [Read more...] about Tensor in NumPy and what may be useful to know about tensor shapes
This program is simple post and get request implementation. Since Python works almost anywhere this is a handy code to have. ''' This is a comment, If you see this, CGI is not working ''' import sys import urllib2 import urllib '''Pickling is the process converting object into a byte stream, and unpickling is the inverse operation.''' try: import cPickle as … [Read more...] about Post and Get requests in Python