What is TensorFlow?
Tensor Flow is a free and open source framework. It was originally developed by the Google Brain team. It is mainly used for numerical computation using data flow graphs.
What is TFT?
TFT stands for TensorFlow Transform. It is an open source library for TensorFlow that allows users to define pre-processing pipelines and run these using large scale data processing frameworks, while also exporting the pipeline in a way that can be run as part of a TensorFlow graph. Users define a pipeline by composing modular Python functions, which tf.Transform then executes with Apache Beam, a framework for large-scale, efficient, distributed data processing.
Explain Eager Execution?
Eager execution provides an imperative interface to TensorFlow (It is similar to NumPy). When you enable eager execution, TensorFlow operations execute immediately; you do not execute a pre-constructed graph with Session.run().Eager mode is moving out of contrib, using eager execution you can run your code without a session.
Eager execution is a flexible machine learning platform for research and experimentation, providing:
An intuitive interface:Structure your code naturally and use Python data structures. Quickly iterate on small models and small data.
Easier debugging:Call ops directly to inspect running models and test changes. Use standard Python debugging tools for immediate error reporting.
Natural control flow:Use Python control flow instead of graph control flow, simplifying the specification of dynamic models.
Eager execution runs by default on CPU, to use GPU include below code:
with tf.device(โ/gpu:0โ)
Eager execution doesnโt create Tensor Graph, to build graph just remove the tf.enable_eager_execution().
What are the Features of Eager Execution?
Eager Execution is compatible with native Python debugging tools
Error logging is immediate
Native Python control flow i.e loops and recursions
Eager execution simplifies your code
Back propagation is built in to eager execution
What if a file is corrupted or missing in a dataset?
It is possible to replace them with other values that run parallel to them. Dropna and isnull are the two methods that are useful in this matter. In some special cases, it is even possible to replace them with desired values and have an error-free outcome.
How does TensorFlow fit into AI and Machine learning?
Tensorflow is one of many machine learning libraries (other examples include CNTK and Theano). Machine learning is a field of computer science that gives computers the ability to learn without being explicitly programmed.[1] For example, AlphaGo Zeroโs AI taught itself to play Go and outperformed its predecessor, AlphaGo, which had defeated the world champion in Go. Machine learning is useful for tasks where explicit algorithms donโt yield good results, such as user screening, sorting high context data and clustering for predictions and profiling.Practical examples include detecting fraud or data breaches, email filtering, optical character recognition (OCR), and ranking.
What is the application of Naรฏve Bayes Naรฏve in Machine Learning?
It is basically a sub-algorithm of a sub-module that defines the conditional probabilities of different components. The final results can be integrated with other possible outcomes to predict the final outcomes. It can also overcome a lot of problems which are related to the unstructured data.
What difference do you find in type1 and type 2 errors?
Type I error is a false positive value. On the other side, Type II error is a false negative value. Type I error generally represent that something has happened when actually it doesnโt while Type II error is to representing the machine that nothing is wrong when actually something is not good.
How useful and reliable Bayesโ theorem is according to you in the Machine Learning context?
This theorem defines the probability of any event in machine learning. It represents a fixed value which is actually a mathematical calculation. This value is generally obtained by dividing the true positive rate divided by the false positive rate. In machine learning, some of the very complex problems and challenges can easily be solved and eliminated with the help of this theorem. Most of the time results provided by it are highly accurate and can easily be trusted.
How K-means clustering is different from KNN?
K-means clustering is basically an unsupervised clustering algorithm. It is capable to tolerate some minor errors. On the other side, the KNN is structured clustering algorithm. For reliable operations, it should be accurate and reliable. The mechanism for both seems very similar at the first glance but users need to label the data in the KNN which is not required in the k-means clustering.
What are TensorFlow loaders?
Tensorflow Loaders are used for adding algorithms and data backends one of which is tensorflow itself. For example, a loader can be implemented to load, access and unload a new type of servable machine learning model
What is ROC curve and its working?
ROC or region of convergence used to reflect data rates which classify as true positive and false positive. Represented in the form of graphs, it can use as a proximity to swap operations related to different algorithms.
Can TensorFlow be deployed in container software?
Tensorflow can also use with containerization tools such as docker, for instance, it could use to deploy a sentiment analysis model which uses character level ConvNet networks for text classification.
What is Sequence-to-Sequence model?
Sequence-to-Sequence (Seq2Seq) models use recurrent neural networks as a building block by feeding lots of sentence pairs during model training so that we can generate one sentence from another sentence. These sentence pairs can be anything. For example, when it is words from two different languages, the model can be used for translations. When it is a pair of conversational messages, the model can be used for chat bots.
What is Keras?
Keras is a high-level library thatโs built on top of Theano or TensorFlow. It provides a scikit-learn type API for building Neural Networks. It is written in Python programming language.Developers can use Keras to quickly build neural networks without worrying about the mathematical aspects of tensor algebra, numerical techniques, and optimisation methods. Itโs used for fast prototyping, state-of-the-art research, and production. While TensorFlow supports Keras today, with 2.0, we are integrating Keras more tightly into the rest of the TensorFlow platform.
What is Max pooling?
A max pooling layer performs down-sampling by dividing the input into rectangular pooling regions, and computing the maximum of each region.
having higher levels of abstraction.
What are the APIs outside TensorFlow project?
TFLearn: This API shouldnโt be seen as TF Learn, which is TensorFlowโs tf.contrib.learn. It is a separate Python package.TensorLayer: It comes as a separate package and is different from what TensorFlowโs layers API has in its bag.
Pretty Tensor: It is actually a Google project which offers a fluent interface with chaining.
Sonnet: It is a project of Googleโs DeepMind which features a modular approach
What are the TensorFlow operations?
TensorFlow operator Description
tf.add x+y
tf.subtract x-y
tf.multiply x*y
tf.div x/y
tf.mod x % y
tf.abs |x|
tf.negative -x
tf.sign sign(x)
tf.square x*x
tf.round round(x)
tf.sqrt sqrt(x)
tf.pow x^y
tf.exp e^x
tf.log log(x)
tf.maximum max(x, y)
tf.minimum min(x, y)
tf.cos cos(x)
tf.sin sin(x)
What are the Sequence Utilities methods?
Sequence utilities include methods such as:
argmin function,:which returns the index with min value across the axes of the input tensor,
argmax function: which returns the index with max value across the axes of the input tensor,
setdiff: which computes the difference between two lists of numbers or strings,
where function:which will return elements either from two passed elements x or y, which depends on the passed condition, or
unique function,:which will return unique elements in a 1-D tensor.
What is Reduction?
Reduction is an operation that removes one or more dimensions from a tensor by performing certain operations across those dimensions.
What are the cons of TensorFlow?
- TensorFlow has GPU memory conflicts with Theano if imported in the same scope. No GPU support other than Nvidia and only language support.
- Missing Symbolic Loops
- No support for OpenCL
- Requires prior knowledge of advanced calculus and linear algebra along with a pretty good understanding of machine learning.
Can you explain Embedding in TensorFlow?
An Embedding in TensorFlow defines as the mapping like the word to vector (word2vec) of real numbers. A TensorFlow embedding example below where a list of colors represents as vectors:
Black: (0.01359, 0.00075997, 0.24608, โฆ, -0.2524, 1.0048, 0.06259)
Blues: (0.01396, 0.11887, -0.48963, โฆ, 0.033483, -0.10007, 0.1158)
Yellow: (-0.24776, -0.12359, 0.20986, โฆ, 0.079717, 0.23865, -0.014213)
Oranges: (-0.35609, 0.21854, 0.080944, โฆ, -0.35413, 0.38511, -0.070976)
The dimensions in these kinds of vectors usually donโt have any meaning, but the pattern of the matrix, as well as the location and distance between the vectors, contains some significant information that can be taken an advantage of.
What is TensorFlow Mobile?
TensorFlow Mobile is used for a mobile platform such as iOS and Android. This is for those developers who have a successful TensorFlow model and want to integrate their model into a mobile environment. This is also for those who are not able to use TensorFlow Lite. Basic challenges one can find in integrating their desktop environment model into the mobile environment are:
- To see how to use TensorFlow mobile.
- Building their model for a mobile platform.
- Adding the TensorFlow libraries into their mobile application.
- Preparing the model file.
- Optimising binary size, file size, RAM usage etc.
Can you explain Data Formats in TensorFlow?
Data Formats is one of the ways for TensorFlow Performance Optimizations. As the name suggests, the structures of the input tensors that passes to the operations. Below are parameters of a 4D tensor:
- N is the number of images in the batch.
- H is the number of pixels in vertical dimensions.
- W is the pixels in horizontal dimensions.
- C is for channels.
The nomenclature of these data formats in broadly split into two:
- NCHW
- NHWC
The default is the latter whereas the firmer is the optimal choice while working on NVIDIA GPUs. It is good to build models that are compatible with both the formats so as to simplify the training on GPUs.
Explain TensorFlow Optimizing for CPU?
There are two configurations below for optimizing CPU performance.
intra_op_parallelism: parallelization of nodes is achieved using multi-threads, thatโll schedule the individual pieces.
inter_op_parallelism: The nodes that are ready are scheduled in this operation.
tf.ConfigProto, is used to set these configurations by passing to in the config attribute of tf.Session. For both parallelism configurations, is initialised as zero, they will revert to the number of logical CPU cores. Equating the number of physical cores to the number of threads rather than using logical cores is another good way of optimization.
What is MNIST Dataset in TensorFlow?
MNIST dataset in TensorFlow, containing information of handwritten digits spiltted into three parts:
Training Data (mnist.train) โ 55000 datapoints
Validation Data (mnist.validate) โ 5000 datapoints
Test Data (mnist.test) โ 10000 datapoints
What is the tfdbg TensorFlow Debugging?
Tenosrflow has its own debugger called the tfdbg TensorFlow Debugging, which lets you observe the intrinsic working and the state of the running graphs. These are difficult to debug with any other general debuggers like pdb in python.
What are the Common TensorFlow Operations?
- tf.rank: Returns the rank of a tensor.
- tf.constant: Creates a constant from a value, type, and shape.
- tf.Variable: Creates a variable from a tensor.
- tf.decode_csv: Converts CSV files to tensors, with each column mapping to a tensor.
- tf.decode_base64: Decodes base-64-encoded tensor strings.
- tf.subtract: Subtracts one tensor from another (must be the same type).
- tf.add: Adds two tensors of the same type together, for numbers and strings.
- tf.to_int32: Converts tensor primitives to int32.
- tf.multiply: Multiplies two tensors of the same type together, for numbers.
- tf.div: Divides numerator by denominator of real numeric types and return quotient.
- tf.abs: The absolute value of the tensor.
- tf.negative: Returns negative value of numeric tensor.
- tf.maximum: Returns the maximum of two tensors for a subset of numeric types.
- tf.minimum: Returns the minimum of two tensor for a subset of numeric types.
- tf.string_to_number: Converts a string tensor to a specified numeric type; specify out_type=tf.DType, where DType is a subset of numeric types.
- tf.concat: Concatenates a tensor, along one specified dimension.
- tf.fill: Creates a tensor filled with a specified scalar value.
- tf.tuple: Groups tensors together.
- tf.zeros: Creates a tensor populated with zeros of a certain numeric type shape.
- tf. convert_to_tensor: Converts the value to a tensor of specified type.
- tf.while_loop: The while loop.
- tf.case: The case operations on bools.
- tf.count_up_to: Increments a mutable tensor of int32 or int64 to an int limit.
- tf.Print: Prints out a debug message of tensors and messages.
- tf.is_nan: Returns elements of tensors that are not a number.
- tf.is_finite: Returns elements of tensors that are finite, for half, float32, and float64.
- tf.logical_and: Returns truth value of each boolean element of two tensors.
- tf.logical_not: Returns truth value of not each boolean element of a tensor.
- tf.logical_or: Returns truth value of each boolean element of two tensors.
- tf.logical_xor: Returns truth value of each of boolean elements, exclusive or.
- tf.equal: Returns truth value of first tensor == second tensor, element-wise, on two tensors.
- tf.not_equal: Returns truth value of first tensor != second tensor, element-wise, on two tensors.
- tf.greater_equal: Returns truth value of first tensor >= second tensor, element-wise, on two tensors.
- tf.greater: Returns truth value of first tensor > second tensor, element-wise, on two tensors.
- tf.less_equal: Returns truth value of first tensor <= second tensor, element-wise, on two tensors.
- tf.less: Returns truth value of first tensor < second tensor, element-wise, on two tensors.
- tf.where: Returns elements from either of two tensors based on condition.
- tf.image.decode_jpeg: Decodes a JPEG image to a uint8 tensor.
- tf.image.decode_png: Decodes a PNG image to a uint8 or uint16 tensor.
- tf.image.decode_gif: Decodes a GIF image to a uint8 tensor.
- tf.image_decode_bmp: Decodes a BMP image to a uint8 tensor.
- tf.image.resize_images: Resizes images to sizes using one of four predefined methods.
- tf.image.rot90: Rotates an image counter-clockwise 90 degrees.
- tf.image.transpose_image: Transposes an image by swapping first two dimensions.
- tf.image.adjust_brightness: Adjusts image brightness.
- tf.image.adjust_contrast: Adjusts contrast of images.
- tf.image.adjust_hue: Adjusts hue of images.
- tf.image.adjust_gamma: Runs gamma correction on input image.
- tf.image.adjust_saturation: Adjusts saturation channel in image.
- tf.image.flip_left_right: Flips an image horizontally.
- tf.image.flip_up_down: Flips an image vertically.
- tf.image.draw_bounding_boxes: Draws bounding boxes on a batch of images.
- tf.nn: A large collection of neural network ops.
- tf.contrib: Contributed libraries around keras, audio, video, TFLearn, and more.
- tf.Session(): An instance of a session that is the environment to execute operations in a graph to compute tensors.