Posts

Showing posts from October, 2020

57.Numpy-Matrix and Matrix operations

Matrices and Matrix Arithmetic Matrices are a foundational element of linear algebra. Matrices are used throughout the field of machine learning in the description of algorithms and processes such as the input data variable (X) when training an algorithm.A matrix is a two-dimensional array of scalars with one or more columns and one or more rows. Defining a Matrix We can represent a matrix in Python using a two-dimensional NumPy array. A NumPy array can be constructed given a list of lists. For example, below is a 2 row, 3 column matrix. # create matrix from numpy import array A = array([[1, 2, 3], [4, 5, 6]]) print(A) o/p: [[1 2 3] [4 5 6]] Matrix Addition # matrix addition from numpy import array # define first matrix A = array([[1, 2, 3],[4, 5, 6]]) print(A) # define second matrix B = array([[1, 2, 3],[4, 5, 6]]) print(B) # add matrices C = A + B  # or  np.add(A,b) print(C) o/p: [[1 2 3] [4 5 6]] [[1 2 3] [4 5 6]] [[ 2 4 6] [ 8 10 12]] Matrix Subtraction # matrix subtra...

56.Numpy Basics- Creating arrays, arithmetic,indexing and slicing,functions

Image
NumPy (Numerical Python) is a popular Python library for numerical and scientific computing. It provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays. NumPy is a fundamental library for data manipulation and analysis in the Python ecosystem and is widely used in various scientific and engineering applications. Here are some of the key features and capabilities of NumPy: Multidimensional Arrays: NumPy provides the ndarray object, which is a highly efficient and flexible array data structure. These arrays can have any number of dimensions and are the building blocks for many scientific and mathematical computations. Element-Wise Operations: NumPy allows you to perform element-wise operations on arrays, making it easy to apply mathematical operations to entire arrays without explicit loops. Mathematical Functions: NumPy includes a wide range of mathematical functions for operations like basic arit...

Syllabus Python For Machine Learning - CST 283 - KTU Minor

  SYLLABUS Module I Programming Environment and Python Basics: Getting Started with Python Programming - Running code in the interactive shell, Editing, Saving, and Running a script. Using editors - IDLE, Jupyter. The software development process - Case Study. Basic coding skills - Working with data types, Numeric data types and Character sets, Keywords,Variables and Assignment statement, Operators, Expressions, Working with numeric data, Type conversions, Comments in the program. Input, Processing, and Output. Formatting output. How Python works. Detecting and correcting syntax errors. Using built in functions and modules in math module. Module II Building Python Programs: Control statements - Selection structure (if-else, switch-case), Iteration structure(for, while),Testing the control statements, Lazy evaluation. Functions - Hiding redundancy and complexity,Arguments and return values, Variable scopes and parameter passing, Named arguments, Main function, Working ...