This document provides an introduction to the SciPy Python library and its uses for scientific computing and data analysis. It discusses how SciPy builds on NumPy to provide functions for domains like linear algebra, integration, interpolation, optimization, statistics, and more. Examples are given of using SciPy for tasks like LU decomposition of matrices, sparse linear algebra, single and double integrals, line plots, and statistics. SciPy allows leveraging Python's simplicity for technical applications involving numerical analysis and data manipulation.
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATIONijaia
Function Approximation is a popular engineering problems used in system identification or Equation
optimization. Due to the complex search space it requires, AI techniques has been used extensively to spot
the best curves that match the real behavior of the system. Genetic algorithm is known for their fast
convergence and their ability to find an optimal structure of the solution. We propose using a genetic
algorithm as a function approximator. Our attempt will focus on using the polynomial form of the
approximation. After implementing the algorithm, we are going to report our results and compare it with
the real function output.
Exposure of Javier Solano, PhD Professor in Computational Physics and System Engineering, National University of Engineering Lima - Peru. Concept, definition and representation of algorithms. Tree constructs, Unified Modeling Languaje (UML).
The document provides an overview of image processing in MATLAB. It discusses the basic data structures used to represent images as matrices and different image types (binary, indexed, grayscale, truecolor). It provides examples of reading and displaying images, enhancing contrast, and calculating basic image statistics. Functions covered include imread, imshow, imhist, histeq, imwrite, imopen, imadjust, im2bw, bwlabel, and regionprops.
Interpolation is a method to estimate values between known data points. It can be used in computer science for tasks like image reconstruction, CAD modeling, and graphics. Secret sharing schemes also use interpolation to distribute secret information among participants in a way that some minimum number of participants are needed to reconstruct the secret. Lagrange interpolation specifically involves defining a polynomial that passes through known data points, which can then be evaluated at other points to interpolate unknown values. While simple, it provides no error checking and mistakes could occur in calculations.
IRJET - Application of Linear Algebra in Machine LearningIRJET Journal
This document discusses the application of linear algebra concepts in machine learning. It begins with an introduction to linear algebra and key concepts like vectors, matrices, and linear transformations. It then provides an introduction to machine learning, including the different types of machine learning algorithms like supervised, unsupervised, and reinforcement learning. It discusses how machine learning is closely related to statistics and introduces some common statistical concepts. Finally, it discusses how linear algebra is widely used in machine learning algorithms like linear regression and support vector machines. Linear algebra allows machine learning models to represent data and map it to specific feature spaces.
This document discusses various applications of interpolation in computer science and engineering. It describes interpolation as a method of constructing new data points within the range of a known discrete data set. Some examples of interpolation applications mentioned include estimating population values, image processing through transformations like resizing and rotation, zooming digital images using different interpolation functions, and ray tracing in computer graphics. Numerical integration techniques like the trapezoidal rule, Simpson's rule, and Romberg's method are also briefly covered.
Interpolation is a process to estimate unknown values between known data points. It can be used in computer graphics, digital imaging, and CAD. In computer science, interpolation helps approximate solutions to iterative methods, reducing computation time. It is also used to smooth experimental data by fitting trend lines in Excel. Secret sharing schemes use interpolation to distribute secrets among participants, where only some can reconstruct the secret using their shares. Lagrange interpolation is one method used in secret sharing.
Graph Tea: Simulating Tool for Graph Theory & AlgorithmsIJMTST Journal
Simulation in teaching has recently entered the field of education. It is used at different levels of instruction.
The teacher is trained practically and also imparted theoretical learning. In Computer Science, Graph theory
is the fundamental mathematics required for better understanding Data Structures. To Teach Graph theory &
Algorithms, We introduced Simulation as an innovative teaching methodology. Students can understand in a
better manner by using simulation. Graph Tea is one of such simulation tool for Graph Theory & Algorithms.
In this paper, we simulated Tree Traversal Techniques like Breadth First Search (BFS), Depth First Search
(DFS) and minimal cost spanning tree algorithms like Prims.
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYAMaulik Borsaniya
This document discusses data visualization and Matplotlib. It begins with an introduction to data visualization and its importance. It then covers basic visualization rules like labeling axes and adding titles. It discusses what Matplotlib is and how to install it. It provides examples of common plot types in Matplotlib like sine waves, scatter plots, bar charts, and pie charts. It also discusses working with data science and Pandas, including how to create Pandas Series and DataFrames from various data sources.
Object Tracking By Online Discriminative Feature Selection AlgorithmIRJET Journal
1) The document presents an online discriminative feature selection algorithm for object tracking. It aims to select discriminative features between the target object and background to improve tracking performance.
2) The algorithm formulates the feature selection problem as optimizing an objective function that maximizes the average confidence of positive samples while suppressing the average confidence of negative samples.
3) It uses a greedy sequential forward selection approach to select weak classifiers from a pool that maximize this objective function. This formulation directly couples the classifier score with sample importance, leading to a more robust and efficient tracker.
The document describes using the Kuhn-Munkres or "Hungarian" algorithm to solve the graph matching problem. It formulates graph matching as a minimum-cost bipartite matching problem that can be solved using the Hungarian algorithm. It then outlines the steps of the algorithm, which involves constructing adjacency matrices for the graphs, computing eigenvectors, obtaining a correlation matrix, converting it into a cost matrix, applying the Hungarian algorithm to find the matching, and outputting the results.
BMVA summer school MATLAB programming tutorialpotaters
This document discusses improving the runtime performance of MATLAB code through vectorization. It provides an example of an inefficient MATLAB function that approximates cycles of a square wave using sine waves. To optimize this code, the document suggests manipulating arrays rather than individual array elements, which can be done by removing the nested for loops. Vectorizing the code to operate on entire arrays at once rather than elements sequentially would improve performance. Profiling the code using MATLAB's profiler tool can help identify bottlenecks to target for optimization.
Data Trend Analysis by Assigning Polynomial Function For Given Data SetIJCERT
This paper aims at explaining the method of creating a polynomial equation out of the given data set which can be used as a representation of the data itself and can be used to run aggregation against itself to find the results. This approach uses least-squares technique to construct a model of data and fit to a polynomial. Differential calculus technique is used on this equation to generate the aggregated results that represents the original data set.
This document provides an introduction to machine learning, including definitions, examples of tasks well-suited to machine learning, and different types of machine learning problems. It discusses how machine learning algorithms learn from examples to produce a program or model, and contrasts this with hand-coding programs. It also briefly covers supervised vs. unsupervised vs. reinforcement learning, hypothesis spaces, regularization, validation sets, Bayesian learning, and maximum likelihood learning.
A simple framework for contrastive learning of visual representationsDevansh16
Link: https://machine-learning-made-simple.medium.com/learnings-from-simclr-a-framework-contrastive-learning-for-visual-representations-6c145a5d8e99
If you'd like to discuss something, text me on LinkedIn, IG, or Twitter. To support me, please use my referral link to Robinhood. It's completely free, and we both get a free stock. Not using it is literally losing out on free money.
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let's connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819
My Substack: https://devanshacc.substack.com/
Live conversations at twitch here: https://rb.gy/zlhk9y
Get a free stock on Robinhood: https://join.robinhood.com/fnud75
This paper presents SimCLR: a simple framework for contrastive learning of visual representations. We simplify recently proposed contrastive self-supervised learning algorithms without requiring specialized architectures or a memory bank. In order to understand what enables the contrastive prediction tasks to learn useful representations, we systematically study the major components of our framework. We show that (1) composition of data augmentations plays a critical role in defining effective predictive tasks, (2) introducing a learnable nonlinear transformation between the representation and the contrastive loss substantially improves the quality of the learned representations, and (3) contrastive learning benefits from larger batch sizes and more training steps compared to supervised learning. By combining these findings, we are able to considerably outperform previous methods for self-supervised and semi-supervised learning on ImageNet. A linear classifier trained on self-supervised representations learned by SimCLR achieves 76.5% top-1 accuracy, which is a 7% relative improvement over previous state-of-the-art, matching the performance of a supervised ResNet-50. When fine-tuned on only 1% of the labels, we achieve 85.8% top-5 accuracy, outperforming AlexNet with 100X fewer labels.
Comments: ICML'2020. Code and pretrained models at this https URL
Subjects: Machine Learning (cs.LG); Computer Vision and Pattern Recognition (cs.CV); Machine Learning (stat.ML)
Cite as: arXiv:2002.05709 [cs.LG]
(or arXiv:2002.05709v3 [cs.LG] for this version)
Submission history
From: Ting Chen [view email]
[v1] Thu, 13 Feb 2020 18:50:45 UTC (5,093 KB)
[v2] Mon, 30 Mar 2020 15:32:51 UTC (5,047 KB)
[v3] Wed, 1 Jul 2020 00:09:08 UTC (5,829 KB)
This document summarizes a student project on building machine learning models to recognize handwritten digits. The project involved collecting handwritten digit data, preprocessing the data, implementing logistic regression with gradient descent, evaluating performance on test data, and achieving over 90% accuracy on the test set. The models have applications in areas like banking, postal services, and document digitization.
This document provides an overview of arrays and operations on arrays using NumPy. It discusses creating arrays, mathematical operations on arrays like basic operations, squaring arrays, indexing and slicing arrays, and shape manipulation. Mathematical operations covered include conditional operations and matrix multiplication. Indexing and slicing cover selecting single elements, counting backwards with negative indexes, and combining positive and negative indexes. Shape manipulation discusses changing an array's shape, size, combining arrays, splitting arrays, and repeating arrays.
- The document is a final report for a stock trading prediction challenge that aimed to predict auction volume for 900 stocks over 350 days.
- The authors tested several machine learning models including K-nearest neighbors, random forests, stacking, and neural networks. They extracted features like principal components, wavelet transforms, and stock embeddings.
- Their best performing model was a hybrid neural network approach, with one network for initial predictions and a second network to correct errors, which outperformed the benchmark model for the challenge.
Standard Statistical Feature analysis of Image Features for Facial Images usi...Bulbul Agrawal
This document compares Principal Component Analysis (PCA) and Independent Component Analysis (ICA) and their application to facial image analysis. It provides an introduction to both PCA and ICA, including their processes and differences. The document then summarizes previous literature comparing PCA and ICA, describes implementations of PCA for facial recognition on Japanese, African, and Asian datasets in MATLAB, and calculates statistical metrics for the original and recognized images. It concludes that PCA is effective for pattern recognition and dimensionality reduction in facial analysis applications.
The document provides an overview of five fundamental machine learning algorithms: linear regression, logistic regression, decision tree learning, k-nearest neighbors, and neural networks. It describes the problem statement, solution, and key aspects of each algorithm. For linear regression, it discusses minimizing the squared error loss to find the optimal regression line. Logistic regression maximizes the likelihood function to find the optimal classification model. Decision tree learning uses an ID3 algorithm to greedily construct a non-parametric model by optimizing the average log-likelihood.
Application of Graph Theory in Computer science using Data Structure.pdfNancy Ideker
This document discusses the application of graph theory in computer science and data structures. It provides definitions of graphs, trees, and other graph theory concepts. It also describes various graph data structures like adjacency lists and matrices. Common graph algorithms like breadth-first search, depth-first search, and topological sorting are also covered. The document gives examples of how graph theory can be applied in areas like social networks, transportation, and computer networking.
This document describes Project 4 for CMPSC 201, which involves writing a C++ program to perform linear regression on a set of (x,y) coordinate data to find the line of best fit. The program must read in the data from a file, calculate statistics like the mean, standard deviation, and correlation coefficient, then use those values to compute the slope and y-intercept of the regression line. It also provides specifications on the required functions and expected inputs/outputs of the program.
This document discusses curve fitting in Matlab. It introduces the Curve Fitting tool and how to use it to fit data to functions. Key aspects covered include importing data into the tool, selecting fitting functions, viewing and analyzing fit results, and plotting residuals. Examples are provided of fitting data to a sine wave, linear function with and without weights, and examining fit confidence bounds and predictions over different ranges. The document provides a tutorial on using Matlab's Curve Fitting tool to model experimental data with functions.
The document discusses new features in the latest version of SigmaPlot statistical analysis and graphing software. Key new features include additional graph types like forest plots and kernel density plots, more options for customizing legends, the ability to set line widths from data columns, and additional file export options. The software also includes more statistical models for curve fitting, new weighting functions, and an improved Akaike information criterion for model selection.
Concurrency and Parallelism, Asynchronous Programming, Network ProgrammingPrabu U
The presentation starts with concurrency and parallelism. Then the concepts of reactive programming is covered. Finally network programming is detailed
File Input/output, Database Access, Data Analysis with PandasPrabu U
The presentation starts with File Input and Output. Then the concepts of Database Access is detailed. Atlast the concepts data analysis with Pandas is covered
Ad
More Related Content
Similar to Computation Using Scipy, Scikit Image, Scikit Learn (20)
Graph Tea: Simulating Tool for Graph Theory & AlgorithmsIJMTST Journal
Simulation in teaching has recently entered the field of education. It is used at different levels of instruction.
The teacher is trained practically and also imparted theoretical learning. In Computer Science, Graph theory
is the fundamental mathematics required for better understanding Data Structures. To Teach Graph theory &
Algorithms, We introduced Simulation as an innovative teaching methodology. Students can understand in a
better manner by using simulation. Graph Tea is one of such simulation tool for Graph Theory & Algorithms.
In this paper, we simulated Tree Traversal Techniques like Breadth First Search (BFS), Depth First Search
(DFS) and minimal cost spanning tree algorithms like Prims.
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYAMaulik Borsaniya
This document discusses data visualization and Matplotlib. It begins with an introduction to data visualization and its importance. It then covers basic visualization rules like labeling axes and adding titles. It discusses what Matplotlib is and how to install it. It provides examples of common plot types in Matplotlib like sine waves, scatter plots, bar charts, and pie charts. It also discusses working with data science and Pandas, including how to create Pandas Series and DataFrames from various data sources.
Object Tracking By Online Discriminative Feature Selection AlgorithmIRJET Journal
1) The document presents an online discriminative feature selection algorithm for object tracking. It aims to select discriminative features between the target object and background to improve tracking performance.
2) The algorithm formulates the feature selection problem as optimizing an objective function that maximizes the average confidence of positive samples while suppressing the average confidence of negative samples.
3) It uses a greedy sequential forward selection approach to select weak classifiers from a pool that maximize this objective function. This formulation directly couples the classifier score with sample importance, leading to a more robust and efficient tracker.
The document describes using the Kuhn-Munkres or "Hungarian" algorithm to solve the graph matching problem. It formulates graph matching as a minimum-cost bipartite matching problem that can be solved using the Hungarian algorithm. It then outlines the steps of the algorithm, which involves constructing adjacency matrices for the graphs, computing eigenvectors, obtaining a correlation matrix, converting it into a cost matrix, applying the Hungarian algorithm to find the matching, and outputting the results.
BMVA summer school MATLAB programming tutorialpotaters
This document discusses improving the runtime performance of MATLAB code through vectorization. It provides an example of an inefficient MATLAB function that approximates cycles of a square wave using sine waves. To optimize this code, the document suggests manipulating arrays rather than individual array elements, which can be done by removing the nested for loops. Vectorizing the code to operate on entire arrays at once rather than elements sequentially would improve performance. Profiling the code using MATLAB's profiler tool can help identify bottlenecks to target for optimization.
Data Trend Analysis by Assigning Polynomial Function For Given Data SetIJCERT
This paper aims at explaining the method of creating a polynomial equation out of the given data set which can be used as a representation of the data itself and can be used to run aggregation against itself to find the results. This approach uses least-squares technique to construct a model of data and fit to a polynomial. Differential calculus technique is used on this equation to generate the aggregated results that represents the original data set.
This document provides an introduction to machine learning, including definitions, examples of tasks well-suited to machine learning, and different types of machine learning problems. It discusses how machine learning algorithms learn from examples to produce a program or model, and contrasts this with hand-coding programs. It also briefly covers supervised vs. unsupervised vs. reinforcement learning, hypothesis spaces, regularization, validation sets, Bayesian learning, and maximum likelihood learning.
A simple framework for contrastive learning of visual representationsDevansh16
Link: https://machine-learning-made-simple.medium.com/learnings-from-simclr-a-framework-contrastive-learning-for-visual-representations-6c145a5d8e99
If you'd like to discuss something, text me on LinkedIn, IG, or Twitter. To support me, please use my referral link to Robinhood. It's completely free, and we both get a free stock. Not using it is literally losing out on free money.
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let's connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819
My Substack: https://devanshacc.substack.com/
Live conversations at twitch here: https://rb.gy/zlhk9y
Get a free stock on Robinhood: https://join.robinhood.com/fnud75
This paper presents SimCLR: a simple framework for contrastive learning of visual representations. We simplify recently proposed contrastive self-supervised learning algorithms without requiring specialized architectures or a memory bank. In order to understand what enables the contrastive prediction tasks to learn useful representations, we systematically study the major components of our framework. We show that (1) composition of data augmentations plays a critical role in defining effective predictive tasks, (2) introducing a learnable nonlinear transformation between the representation and the contrastive loss substantially improves the quality of the learned representations, and (3) contrastive learning benefits from larger batch sizes and more training steps compared to supervised learning. By combining these findings, we are able to considerably outperform previous methods for self-supervised and semi-supervised learning on ImageNet. A linear classifier trained on self-supervised representations learned by SimCLR achieves 76.5% top-1 accuracy, which is a 7% relative improvement over previous state-of-the-art, matching the performance of a supervised ResNet-50. When fine-tuned on only 1% of the labels, we achieve 85.8% top-5 accuracy, outperforming AlexNet with 100X fewer labels.
Comments: ICML'2020. Code and pretrained models at this https URL
Subjects: Machine Learning (cs.LG); Computer Vision and Pattern Recognition (cs.CV); Machine Learning (stat.ML)
Cite as: arXiv:2002.05709 [cs.LG]
(or arXiv:2002.05709v3 [cs.LG] for this version)
Submission history
From: Ting Chen [view email]
[v1] Thu, 13 Feb 2020 18:50:45 UTC (5,093 KB)
[v2] Mon, 30 Mar 2020 15:32:51 UTC (5,047 KB)
[v3] Wed, 1 Jul 2020 00:09:08 UTC (5,829 KB)
This document summarizes a student project on building machine learning models to recognize handwritten digits. The project involved collecting handwritten digit data, preprocessing the data, implementing logistic regression with gradient descent, evaluating performance on test data, and achieving over 90% accuracy on the test set. The models have applications in areas like banking, postal services, and document digitization.
This document provides an overview of arrays and operations on arrays using NumPy. It discusses creating arrays, mathematical operations on arrays like basic operations, squaring arrays, indexing and slicing arrays, and shape manipulation. Mathematical operations covered include conditional operations and matrix multiplication. Indexing and slicing cover selecting single elements, counting backwards with negative indexes, and combining positive and negative indexes. Shape manipulation discusses changing an array's shape, size, combining arrays, splitting arrays, and repeating arrays.
- The document is a final report for a stock trading prediction challenge that aimed to predict auction volume for 900 stocks over 350 days.
- The authors tested several machine learning models including K-nearest neighbors, random forests, stacking, and neural networks. They extracted features like principal components, wavelet transforms, and stock embeddings.
- Their best performing model was a hybrid neural network approach, with one network for initial predictions and a second network to correct errors, which outperformed the benchmark model for the challenge.
Standard Statistical Feature analysis of Image Features for Facial Images usi...Bulbul Agrawal
This document compares Principal Component Analysis (PCA) and Independent Component Analysis (ICA) and their application to facial image analysis. It provides an introduction to both PCA and ICA, including their processes and differences. The document then summarizes previous literature comparing PCA and ICA, describes implementations of PCA for facial recognition on Japanese, African, and Asian datasets in MATLAB, and calculates statistical metrics for the original and recognized images. It concludes that PCA is effective for pattern recognition and dimensionality reduction in facial analysis applications.
The document provides an overview of five fundamental machine learning algorithms: linear regression, logistic regression, decision tree learning, k-nearest neighbors, and neural networks. It describes the problem statement, solution, and key aspects of each algorithm. For linear regression, it discusses minimizing the squared error loss to find the optimal regression line. Logistic regression maximizes the likelihood function to find the optimal classification model. Decision tree learning uses an ID3 algorithm to greedily construct a non-parametric model by optimizing the average log-likelihood.
Application of Graph Theory in Computer science using Data Structure.pdfNancy Ideker
This document discusses the application of graph theory in computer science and data structures. It provides definitions of graphs, trees, and other graph theory concepts. It also describes various graph data structures like adjacency lists and matrices. Common graph algorithms like breadth-first search, depth-first search, and topological sorting are also covered. The document gives examples of how graph theory can be applied in areas like social networks, transportation, and computer networking.
This document describes Project 4 for CMPSC 201, which involves writing a C++ program to perform linear regression on a set of (x,y) coordinate data to find the line of best fit. The program must read in the data from a file, calculate statistics like the mean, standard deviation, and correlation coefficient, then use those values to compute the slope and y-intercept of the regression line. It also provides specifications on the required functions and expected inputs/outputs of the program.
This document discusses curve fitting in Matlab. It introduces the Curve Fitting tool and how to use it to fit data to functions. Key aspects covered include importing data into the tool, selecting fitting functions, viewing and analyzing fit results, and plotting residuals. Examples are provided of fitting data to a sine wave, linear function with and without weights, and examining fit confidence bounds and predictions over different ranges. The document provides a tutorial on using Matlab's Curve Fitting tool to model experimental data with functions.
The document discusses new features in the latest version of SigmaPlot statistical analysis and graphing software. Key new features include additional graph types like forest plots and kernel density plots, more options for customizing legends, the ability to set line widths from data columns, and additional file export options. The software also includes more statistical models for curve fitting, new weighting functions, and an improved Akaike information criterion for model selection.
Concurrency and Parallelism, Asynchronous Programming, Network ProgrammingPrabu U
The presentation starts with concurrency and parallelism. Then the concepts of reactive programming is covered. Finally network programming is detailed
File Input/output, Database Access, Data Analysis with PandasPrabu U
The presentation starts with File Input and Output. Then the concepts of Database Access is detailed. Atlast the concepts data analysis with Pandas is covered
String Handling, Inheritance, Packages and InterfacesPrabu U
The presentation starts with string handling. Then the concepts of inheritance is detailed. Finally the concepts of packages and interfaces are detailed.
This presentation starts with the history and evolution of Java followed by OOP paradigms. Then the data types, variables and arrays were discussed. After that the classes and objects were introduced
The document provides an introduction to XML including its structure, elements, attributes, and namespaces. It discusses XML declarations, document type declarations, elements, attributes, character data, comments, processing instructions, content models, and the handling of whitespace in XML documents. It also covers XML namespaces, default and explicit namespace declarations, and the scope of namespaces. Finally, it discusses the structure of document type definitions including elements, attributes, entities, and directives.
Introduction to Web Services, UDDI, SOAP, WSDL, Web Service Architecture, Developing and deploying web services.
Ajax – Improving web page performance using Ajax, Programming in Ajax.
The document discusses XML (eXtensible Markup Language) and related technologies. It begins with an introduction to XML, describing it as a means of structuring data. It then covers XML revolutions, basics, defining XML documents using DTDs and XML Schema, and technologies related to XML like XPath and XSLT. Key topics include XML design goals, roles of XML, XML document structure, element rules and types in DTDs, attributes, entities, and data types in XML Schema. The document provides information on core XML concepts in a technical yet concise manner.
Internet Principles and Components, Client-Side ProgrammingPrabu U
Internet Principles and Components: History of the Internet and World Wide Web – HTML - Protocols – HTTP, SMTP, POP3, MIME, and IMAP. Domain Name Server, Web Browsers and Web Servers. HTML- Style Sheets- CSS- Introduction to Cascading Style Sheets-Rule- Features- Selectors- Attributes.
Client-Side Programming: The JavaScript Language- JavaScript in Perspective-Syntax-Variables and Data Types- Statements- Operators- Literals- Functions- Objects- Arrays-Built-in Objects- JavaScript Debuggers and Regular Expression.
This document provides an overview of operations management, marketing management, and financial management. It discusses topics such as production planning and control, quality control, inventory control, pricing strategies, product development, distribution channels, and promotional activities. Key points covered include the importance of customer orientation, integrating marketing mix elements, using techniques like critical path analysis and linear programming in operations, and balancing costs and market demands in pricing decisions.
This document provides an overview of management concepts including:
- The nature and importance of management including its functions such as decision making, organizing, staffing, etc.
- The development of management thought from classical to modern approaches.
- The importance of ethical and environmental foundations for management including managing social responsibility and value systems.
- Key philosophies of management and how they differ between organizations.
This document discusses replacement and maintenance analysis, including determining the economic life of assets. It provides examples of calculating the economic life of equipment using total cost when interest is 0% and 12%. It also discusses replacement of existing assets, types of maintenance, and a simple probabilistic model for items that fail completely. Optimal replacement policies are determined by comparing individual and group replacement costs. The document also covers several methods of depreciation, including straight-line depreciation calculation examples.
This document provides an overview of engineering economics and elementary economic analysis concepts. It discusses the definition and goals of economics, including the production and distribution of goods and services for human welfare. Key points covered include the law of supply and demand, factors that influence supply and demand, costs and revenues, break-even analysis, and the profit-volume ratio. Elementary economic analysis is introduced as a way to make economic decisions by considering factors like price, transportation costs, availability, and quality when evaluating alternatives. Examples are also provided to illustrate basic economic analysis concepts.
This document provides an overview of engineering economics and management concepts across 4 sections:
1. It introduces microeconomics, macroeconomics, economic and technical decisions, demand and supply concepts, and break-even analysis.
2. It defines microeconomics as the study of particular markets and segments of the economy like consumer behavior and firm theory. It also outlines characteristics, scope, and importance of microeconomics.
3. It states that macroeconomics deals with aggregates like national income rather than individual quantities. It discusses key issues in macroeconomics like economic growth, business cycles, and unemployment.
4. It describes the process of managerial decision making and sources of uncertainty. It also distingu
This document discusses files and file operations in C programming. It covers opening, closing, reading from, and writing to files. Key points include:
- There are different modes for opening files, such as read ("r"), write ("w"), and append ("a").
- Common file functions include fopen() to open a file, fclose() to close it, fread() and fwrite() for reading and writing data, and fgetc() and fputc() for characters.
- Files can be accessed sequentially from the beginning or randomly by using functions like fseek() and ftell() to set and get the file position.
- Command line arguments allow passing parameters to a
The document discusses structures in C programming. It defines structures as a way to pack together logically related data items of different types. Some key points:
- Structures allow defining custom data types that group together members of integer, float, character, and other standard types.
- Structure variables are declared and members accessed using the dot operator. Arrays of structures can also be defined.
- Structures can be initialized in various ways and passed to functions by value or by reference.
- Nested structures, where one structure is defined as a member of another, are also supported.
The document also covers arrays of structures, passing structures to functions, user-defined data types using typedef and enums,
Decision Making Statements, Arrays, StringsPrabu U
The document discusses various decision making and looping statements in C programming language. It describes if, if-else, nested if, switch statements for decision making. It also covers while, for, do-while and nested loops for looping/iteration. Examples are provided for each statement to illustrate their syntax and usage. Arrays, functions, recursion and passing arrays to functions are also mentioned as topics to be covered.
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfMohamedAbdelkader115
Glad to be one of only 14 members inside Kuwait to hold this credential.
Please check the members inside kuwait from this link:
https://www.rics.org/networking/find-a-member.html?firstname=&lastname=&town=&country=Kuwait&member_grade=(AssocRICS)&expert_witness=&accrediation=&page=1
Passenger car unit (PCU) of a vehicle type depends on vehicular characteristics, stream characteristics, roadway characteristics, environmental factors, climate conditions and control conditions. Keeping in view various factors affecting PCU, a model was developed taking a volume to capacity ratio and percentage share of particular vehicle type as independent parameters. A microscopic traffic simulation model VISSIM has been used in present study for generating traffic flow data which some time very difficult to obtain from field survey. A comparison study was carried out with the purpose of verifying when the adaptive neuro-fuzzy inference system (ANFIS), artificial neural network (ANN) and multiple linear regression (MLR) models are appropriate for prediction of PCUs of different vehicle types. From the results observed that ANFIS model estimates were closer to the corresponding simulated PCU values compared to MLR and ANN models. It is concluded that the ANFIS model showed greater potential in predicting PCUs from v/c ratio and proportional share for all type of vehicles whereas MLR and ANN models did not perform well.
International Journal of Distributed and Parallel systems (IJDPS)samueljackson3773
The growth of Internet and other web technologies requires the development of new
algorithms and architectures for parallel and distributed computing. International journal of
Distributed and parallel systems is a bimonthly open access peer-reviewed journal aims to
publish high quality scientific papers arising from original research and development from
the international community in the areas of parallel and distributed systems. IJDPS serves
as a platform for engineers and researchers to present new ideas and system technology,
with an interactive and friendly, but strongly professional atmosphere.
☁️ GDG Cloud Munich: Build With AI Workshop - Introduction to Vertex AI! ☁️
Join us for an exciting #BuildWithAi workshop on the 28th of April, 2025 at the Google Office in Munich!
Dive into the world of AI with our "Introduction to Vertex AI" session, presented by Google Cloud expert Randy Gupta.
The Fluke 925 is a vane anemometer, a handheld device designed to measure wind speed, air flow (volume), and temperature. It features a separate sensor and display unit, allowing greater flexibility and ease of use in tight or hard-to-reach spaces. The Fluke 925 is particularly suitable for HVAC (heating, ventilation, and air conditioning) maintenance in both residential and commercial buildings, offering a durable and cost-effective solution for routine airflow diagnostics.
In tube drawing process, a tube is pulled out through a die and a plug to reduce its diameter and thickness as per the requirement. Dimensional accuracy of cold drawn tubes plays a vital role in the further quality of end products and controlling rejection in manufacturing processes of these end products. Springback phenomenon is the elastic strain recovery after removal of forming loads, causes geometrical inaccuracies in drawn tubes. Further, this leads to difficulty in achieving close dimensional tolerances. In the present work springback of EN 8 D tube material is studied for various cold drawing parameters. The process parameters in this work include die semi-angle, land width and drawing speed. The experimentation is done using Taguchi’s L36 orthogonal array, and then optimization is done in data analysis software Minitab 17. The results of ANOVA shows that 15 degrees die semi-angle,5 mm land width and 6 m/min drawing speed yields least springback. Furthermore, optimization algorithms named Particle Swarm Optimization (PSO), Simulated Annealing (SA) and Genetic Algorithm (GA) are applied which shows that 15 degrees die semi-angle, 10 mm land width and 8 m/min drawing speed results in minimal springback with almost 10.5 % improvement. Finally, the results of experimentation are validated with Finite Element Analysis technique using ANSYS.
ELectronics Boards & Product Testing_Shiju.pdfShiju Jacob
This presentation provides a high level insight about DFT analysis and test coverage calculation, finalizing test strategy, and types of tests at different levels of the product.
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...Infopitaara
A feed water heater is a device used in power plants to preheat water before it enters the boiler. It plays a critical role in improving the overall efficiency of the power generation process, especially in thermal power plants.
🔧 Function of a Feed Water Heater:
It uses steam extracted from the turbine to preheat the feed water.
This reduces the fuel required to convert water into steam in the boiler.
It supports Regenerative Rankine Cycle, increasing plant efficiency.
🔍 Types of Feed Water Heaters:
Open Feed Water Heater (Direct Contact)
Steam and water come into direct contact.
Mixing occurs, and heat is transferred directly.
Common in low-pressure stages.
Closed Feed Water Heater (Surface Type)
Steam and water are separated by tubes.
Heat is transferred through tube walls.
Common in high-pressure systems.
⚙️ Advantages:
Improves thermal efficiency.
Reduces fuel consumption.
Lowers thermal stress on boiler components.
Minimizes corrosion by removing dissolved gases.
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYijscai
With the increased use of Artificial Intelligence (AI) in malware analysis there is also an increased need to
understand the decisions models make when identifying malicious artifacts. Explainable AI (XAI) becomes
the answer to interpreting the decision-making process that AI malware analysis models use to determine
malicious benign samples to gain trust that in a production environment, the system is able to catch
malware. With any cyber innovation brings a new set of challenges and literature soon came out about XAI
as a new attack vector. Adversarial XAI (AdvXAI) is a relatively new concept but with AI applications in
many sectors, it is crucial to quickly respond to the attack surface that it creates. This paper seeks to
conceptualize a theoretical framework focused on addressing AdvXAI in malware analysis in an effort to
balance explainability with security. Following this framework, designing a machine with an AI malware
detection and analysis model will ensure that it can effectively analyze malware, explain how it came to its
decision, and be built securely to avoid adversarial attacks and manipulations. The framework focuses on
choosing malware datasets to train the model, choosing the AI model, choosing an XAI technique,
implementing AdvXAI defensive measures, and continually evaluating the model. This framework will
significantly contribute to automated malware detection and XAI efforts allowing for secure systems that
are resilient to adversarial attacks.
We introduce the Gaussian process (GP) modeling module developed within the UQLab software framework. The novel design of the GP-module aims at providing seamless integration of GP modeling into any uncertainty quantification workflow, as well as a standalone surrogate modeling tool. We first briefly present the key mathematical tools on the basis of GP modeling (a.k.a. Kriging), as well as the associated theoretical and computational framework. We then provide an extensive overview of the available features of the software and demonstrate its flexibility and user-friendliness. Finally, we showcase the usage and the performance of the software on several applications borrowed from different fields of engineering. These include a basic surrogate of a well-known analytical benchmark function; a hierarchical Kriging example applied to wind turbine aero-servo-elastic simulations and a more complex geotechnical example that requires a non-stationary, user-defined correlation function. The GP-module, like the rest of the scientific code that is shipped with UQLab, is open source (BSD license).
Analysis of reinforced concrete deep beam is based on simplified approximate method due to the complexity of the exact analysis. The complexity is due to a number of parameters affecting its response. To evaluate some of this parameters, finite element study of the structural behavior of the reinforced self-compacting concrete deep beam was carried out using Abaqus finite element modeling tool. The model was validated against experimental data from the literature. The parametric effects of varied concrete compressive strength, vertical web reinforcement ratio and horizontal web reinforcement ratio on the beam were tested on eight (8) different specimens under four points loads. The results of the validation work showed good agreement with the experimental studies. The parametric study revealed that the concrete compressive strength most significantly influenced the specimens’ response with the average of 41.1% and 49 % increment in the diagonal cracking and ultimate load respectively due to doubling of concrete compressive strength. Although the increase in horizontal web reinforcement ratio from 0.31 % to 0.63 % lead to average of 6.24 % increment on the diagonal cracking load, it does not influence the ultimate strength and the load-deflection response of the beams. Similar variation in vertical web reinforcement ratio leads to an average of 2.4 % and 15 % increment in cracking and ultimate load respectively with no appreciable effect on the load-deflection response.
Computation Using Scipy, Scikit Image, Scikit Learn
1. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
VELAGAPUDI RAMAKRISHNA SIDDHARTHA ENGINEERING COLLEGE
20CSH4801A
ADVANCED PYTHON PROGRAMMING
UNIT 4
Lecture By,
Prabu. U
Assistant Professor,
Department of Computer Science and Engineering.
2. UNIT 4:
Computation Using Scipy: Optimization and Minimization,
Interpolation, Integration, Statistics, Spatial and Clustering Analysis,
Signal and Image Processing, Sparse Matrices, Reading and Writing
Files.
SciKit: Going One Step Further: Scikit Image: Dynamic Threshold,
Local Maxima; Scikit-Learn: Linear Regression and Clustering.
20CSH4801A ₋ ADVANCED PYTHON PROGRAMMING
3. 1. Optimization and Minimization
2. Interpolation
3. Integration
4. Statistics
5. Spatial and Clustering Analysis
6. Signal and Image Processing
7. Sparse Matrices
8. Reading and Writing Files Beyond NumPy
COMPUTATION USING SCIPY
4. 1. Scikit-Image
(i) Dynamic Threshold
(ii) Local Maxima
2. Scikit-Learn
(i) Linear Regression
(ii) Clustering
SCIKIT: GOING ONE STEP FURTHER
5. SciPy
The SciPy library is one of the core packages for scientific computing that
provides mathematical algorithms and convenience functions built on the
NumPy extension of Python.
It used to take on standard problems that scientists and engineers commonly
face: integration, determining a function’s maxima or minima, finding
eigenvectors for large sparse matrices, testing whether two distributions are
the same, and much more.
6. 1. Optimization and Minimization
The optimization package in SciPy allows us to solve minimization problems
easily and quickly.
But wait: what is minimization and how can it help you with your work?
Some classic examples are performing linear regression, finding a function’s
minimum and maximum values, determining the root of a function, and
finding where two functions intersect.
Below we begin with a simple linear regression and then expand it to fitting
non-linear data.
7. (i) Data Modeling and Fitting
There are several ways to fit data with a linear regression.
In this section we will use curve_fit, which is a 2
−based method (in other
words, a best-fit method).
In the example below, we generate data from a known function with noise,
and then fit the noisy data with curve_fit.
The function we will model in the example is a simple linear equation, f (x) =
ax + b
Refer CurveFitEx.py
9. The values from popt, if a good fit, should be close to the values for the y
assignment.
You can check the quality of the fit with pcov, where the diagonal elements are
the variances for each parameter.
The below Figure gives a visual illustration of the fit.
Taking this a step further, we can do a least-squares fit to a Gaussian profile, a
non-linear function:
where a is a scalar, μ is the mean, and σ is the standard deviation.
11. Refer CurveFit1.py
As we can see in Figure, the result from the Gaussian fit is acceptable.
Going one more step, we can fit a one-dimensional dataset with multiple
Gaussian profiles.
The func is now expanded to include two Gaussian equations with different
input variables. This example would be the classic case of fitting line spectra
(see Figure).
Refer CurveFitEx2.py
13. (ii) Solutions to Functions
With data modeling and fitting under our belts, we can move on to finding
solutions, such as “What is the root of a function?” or “Where do two
functions intersect?” SciPy provides an arsenal of tools to do this in the
optimize module.
Let’s start simply, by solving for the root of an equation (see Figure). Here we
will use scipy.optimize.fsolve.
Refer FSolveEx.py
15. Finding the intersection points between two equations is nearly as simple.
Refer IntersectionEx.py
As we can see in Figure, the intersection points are well identified. Keep in
mind that the assumptions about where the functions will intersect are
important. If these are incorrect, you could get specious results.
17. 2. Interpolation
Data that contains information usually has a functional form, and as analysts
we want to model it.
Given a set of sample data, obtaining the intermediate values between the
points is useful to understand and predict what the data will do in the non-
sampled domain.
SciPy offers well over a dozen different functions for interpolation, ranging
from those for simple univariate cases to those for complex multivariate ones.
Univariate interpolation is used when the sampled data is likely led by one
independent variable, whereas multivariate interpolation assumes there is
more than one independent variable.
18. There are two basic methods of interpolation: (1) Fit one function to an entire
dataset or (2) fit different parts of the dataset with several functions where the
joints of each function are joined smoothly.
The second type is known as a spline interpolation, which can be a very
powerful tool when the functional form of data is complex.
We will first show how to interpolate a simple function, and then proceed to a
more complex case.
The example below interpolates a sinusoidal function (see Figure) using
scipy.interpolate.interp1d with different fitting parameters. The first
parameter is a “linear” fit and the second is a “quadratic” fit.
Refer SinusoidalEx.py
19. Figure: Synthetic data points (red dots) interpolated with linear and quadratic parameters
20. Can we interpolate noisy data? Yes, and it is surprisingly easy, using a spline-
fitting function called scipy.interpolate.UnivariateSpline. (The
result is shown in Figure.)
Refer NoiseInterpolationEx.py
The option s is the smoothing factor, which should be used when fitting data
with noise. If instead s=0, then the interpolation will go through all points
while ignoring noise.
21. Last but not least, we go over a multivariate example—in this case, to
reproduce an image.
The scipy.interpolate.griddata function is used for its capacity to deal
with Unstructured N-dimensional data.
For example, if you have a 1000× 1000-pixel image, and then randomly selected
1000 points, how well could you reconstruct the image? Refer to Figure to see
how well scipy.interpolate.griddata performs.
Refer MultivariateEx.py
22. Figure: Original image with random sample (black points, left) and the interpolated image (right)
23. On the left-hand side of Figure is the original image; the black points are the
randomly sampled positions.
On the right-hand side is the interpolated image. There are some slight glitches
that come from the sample being too sparse for the finer structures.
The only way to get a better interpolation is with a larger sample size. (Note
that the griddata function has been recently added to SciPy and is only
available for version 0.9 and beyond.)
24. If we employ anothermultivariate spline interpolation, how would its results
compare? Here we use scipy.interpolate.SmoothBivariateSpline,
where the code is quite similar to that in the previous example.
Refer MultivariateSplineEx.py
We have a similar result to that in the last example (Figure). The left panel
shows the original imagewith randomly sampled points, and in the right panel
is the interpolated data.
The SmoothBivariateSpline function appears to work a bit better than griddata,
with an exception in the upper-right corner.
25. Figure: Original image with random sample (black points, left) and the interpolated image (right)
26. 3. Integration
Integration is a crucial tool in math and science, as differentiation and
integration are the two key components of calculus.
Given a curve from a function or a dataset, we can calculate the area below it.
In the traditional classroom setting we would integrate a function
analytically, but data in the research setting is rarely given in this form, and
we need to approximate its definite integral.
SciPy has a range of different functions to integrate equations and data. We
will first go over these functions, and then move on to the data solutions.
Afterward, we will employ the data-fitting tools we used earlier to compute
definite integral solutions.
27. (i) Analytic Integration
We will begin working with the function expressed below.
It is straightforward to integrate, and its solution’s estimated error is small. See
Figure for the visual context of what is being calculated.
Refer IntegrationEx.py
29. Figure: Definite integral (shaded region) of a function. The original function is the
line and the randomly sampled data points are in red.
30. (ii) Numerical Integration
Let’s move on to a problem where we are given data instead of some known
equation and numerical integration is needed.
Figure illustrates what type of data sample can be used to approximate
acceptable indefinite integrals.
Refer NumericalIntegration.py
The quad integrator can only work with a callable function, whereas trapz is
a numerical integrator that utilizes data points.
31. 4. Statistics
In NumPy there are basic statistical functions like mean, std, median,
argmax, and argmin.
Moreover, the numpy.arrays have built-in methods that allow us to use
most of the NumPy statistics easily.
Refer SimpleStatistics.py
For quick calculations these methods are useful, but more is usually needed
for quantitative research. SciPy offers an extended collection of statistical tools
such as distributions (continuous or discrete) and functions.
32. (i) Continuous and Discrete Distributions
There are roughly 80 continuous distributions and over 10 discrete
distributions.
Twenty of the continuous functions are shown in Figure as probability
density functions (PDFs) to give a visual impression of what the
scipy.stats package provides.
These distributions are useful as random number generators, similar to the
functions found in numpy.random.
Yet the rich variety of functions SciPy provides stands in contrast to the
numpy.random functions, which are limited to uniform and Gaussian-like
distributions.
33. When we call a distribution from scipy.stats, we can extract its information
in several ways: probability density functions (PDFs), cumulative distribution
functions (CDFs), random variable samples (RVSs), percent point functions
(PPFs), and more. So how do we set up SciPy to give us these distributions?
Working with the classic normal function.
How to access the distribution is demonstrated in PDFEx.py
35. The distribution can be centered at a different point and scaled with the
options loc and scale as shown in the example. This works as easily with all
distributions because of their functional behavior, so it is important to read the
documentation when necessary.
In other cases one will need a discrete distribution like the Poisson, binomial,
or geometric.
Unlike continuous distributions, discrete distributions are useful for problems
where a given number of events occur in a fixed interval of time/space, the
events occur with a known average rate, and each event is independent of the
prior event.
The probability mass function (PMF) of the geometric distribution
36. (ii) Functions
There are more than 60 statistical functions in SciPy, which can be
overwhelming to digest if you simply are curious about what is available.
The best way to think of the statistics functions is that they either describe or
test samples—for example, the frequency of certain values or the Kolmogorov-
Smirnov test, respectively.
Since SciPy provides a large range of distributions, it would be great to take
advantage of the ones we covered earlier.
In the stats package, there are a number of functions such as kstest and
normaltest that test samples.
37. These distribution tests can be very helpful in determining whether a sample
comes from some particular distribution or not.
Before applying these, be sure you have a good understanding of your data, to
avoid misinterpreting the functions’ results.
Refer KolmogorovEx.py
Researchers commonly use descriptive functions for statistics. Some
descriptive functions that are available in the stats package include the
geometric mean (gmean), the skewness of a sample (skew), and the frequency
of values in a sample (itemfreq).
Using these functions is simple and does not require much input. A few
examples follow. Refer DescriptiveFuncEx.py
38. 5. Spatial and Clustering Analysis
From biological to astrophysical sciences, spatial and clustering analysis are
key to identifying patterns, groups, and clusters.
In biology, for example, the spacing of different plant species hints at how
seeds are dispersed, interact with the environment, and grow. In astrophysics,
these analysis techniques are used to seek and identify star clusters, galaxy
clusters, and large-scale filaments (composed of galaxy clusters).
In the computer science domain, identifying and mapping complex networks
of nodes and information is a vital study all on its own.
With big data and data mining, identifying data clusters is becoming
important, in order to organize discovered information, rather than being
overwhelmed by it.
39. SciPy provides a spatial analysis class (scipy.spatial) and a cluster analysis
class (scipy.cluster).
The spatial class includes functions to analyze distances between data points
(e.g., k-d trees).
The cluster class provides two overarching subclasses: vector quantization (vq)
and hierarchical clustering (hierarchy).
Vector quantization groups large sets of data points (vectors) where each group
is represented by centroids. The hierarchy subclass contains functions to
construct clusters and analyze their substructures.
40. (i) Vector Quantization
Vector quantization is a general term that can be associated with signal processing,
data compression, and clustering.
Here we will focus on the clustering component, starting with how to feed data to the
vq package in order to identify clusters.
Refer VectorQuantEx.py
The result of the identified clusters matches up quite well to the original data, as
shown in Figure (the generated cluster data is on the left and the vq-identified
clusters are the on the right).
But this was done only for data that had little noise. What happens if there is a
randomly distributed set of points in the field? The algorithm fails with flying colors.
See Figure for a nice illustration of this.
41. Figure: Original clusters (left) and vq.kmeans-identified clusters (right). Points are
associated to a cluster by color
42. Figure: The uniformly distributed data shows the weak point of the vq.kmeans function
43. (ii) Hierarchical Clustering
Hierarchical clustering is a powerful tool for identifying structures that are
nested within larger structures. But working with the output can be tricky, as
we do not get cleanly identified clusters like we do with the kmeans
technique.
Below is an example wherein we generate a system of multiple clusters.
To employ the hierarchy function, we build a distance matrix, and the output
is a dendrogram tree. See Figure for a visual example of how hierarchical
clustering works.
Refer HClusteringEx.py
44. Seeing the distance matrix in the figure with the dendrogram tree highlights
how the large and small structures are identified.
The question is, how do we distinguish the structures from one another? Here
we use a function called fcluster that provides us with the indices to each of
the clusters at some threshold.
The output from fcluster will depend on the method you use when
calculating the linkage function, such as complete or single.
The cutoff value you assign to the cluster is given as the second input in the
fcluster function. In the dendrogram function, the cutoff’s default is 0.7 *
np.max(Y[:,2]), but here we will use the same cutoff as in the previous
example, with the scaler 0.3.
46. 6. Signal and Image Processing
SciPy allows us to read and write image files like JPEG and PNG images
without worrying too much about the file structure for color images.
Below, we run through a simple illustration of working with image files to
make a nice image (see Figure) from the International Space Station (ISS).
Refer StackedImage.py
The JPG images in the Python environment are NumPy arrays with (426, 640,
3), where the three layers are red, green, and blue, respectively.
In the original stacked image, seeing the star trails above Earth is nearly
impossible.
47. Figure: A stacked image that is composed of hundreds of exposures from the International
Space Station.
48. We modify the previous example to enhance the star trails as shown in Figure
Refer StarTrails.py
When dealing with images without SciPy, you have to be more concerned
about keeping the array values in the right format when saving them as image
files. SciPy deals with that nicely and allows us to focus on processing the
images and obtaining our desired effects.
49. Figure: A stacked image that is composed of hundreds of exposures from the International
Space Station.
50. 7. Sparse Matrices
With NumPy we can operate with reasonable speeds on arrays containing 106
elements.
Once we go up to 107 elements, operations can start to slowdown and Python’s
memory will become limited, depending on the amount of RAM available.
What’s the best solution if you need to work with an array that is far larger—
say, 1010 elements? If these massive arrays primarily contain zeros, then you’re
in luck, as this is the property of sparse matrices.
If a sparse matrix is treated correctly, operation time and memory usage can
go down drastically. The simple example below illustrates this.
51. Refer SparseMatrices.py
The memory allotted to the NumPy array and sparse matrix were 68MB and 0.68MB,
respectively.
In the same order, the times taken to process the Eigen commands were 36.6 and 0.2
seconds on my computer.
This means that the sparse matrix was 100 times more memory efficient and the Eigen
operation was roughly 150 times faster than the non-sparse cases.
In 2D and 3D geometry, there are many sparse data structures used in fields like
engineering, computational fluid dynamics, electromagnetism, thermodynamics, and
acoustics.
Non-geometric instances of sparse matrices are applicable to optimization, economic
modeling, mathematics and statistics, and network/graph theories.
52. Using scipy.io, you can read and write common sparse matrix file formats such
as Matrix Market and Harwell-Boeing, or load MatLab files.
This is especially useful for collaborations with others who use these data
formats.
53. 8. Reading and Writing Files Beyond NumPy
NumPy provides a good set of input and output capabilities with ASCII files.
Its binary support is great if you only need to share information to be read
from one Python environment to another.
But what about more universally used binary file formats?
If you are using Matlab or collaborating with others who are using it, then as
briefly mentioned in the previous section, it is not a problem for NumPy to
read and write Matlab-supported files (using scipy.io.loadmat and
scipy.savemat).
54. In fields like astronomy, geography, and medicine, there is a programming
language called IDL.
It saves files in a binary format and can be read by NumPy using a built-in
package called scipy.io.readsav. It is a flexible and fast module, but it
does not have writing capabilities.
Last but not least, you can query, read, and write Matrix Market files. These are
very commonly used to share matrix data structures that are written in ASCII
format.
This format is well supported in other languages like C, Fortran, and Matlab,
so it is a good format to use due to its universality and user readability. It is
also suitable for sparse matrices.
55. 1. Scikit-Image
(i) Dynamic Threshold
(ii) Local Maxima
2. Scikit-Learn
(i) Linear Regression
(ii) Clustering
SCIKIT: GOING ONE STEP FURTHER
56. 1. Scikit-Image
SciPy’s ndimage class contains many useful tools for processingmulti-
dimensional data, such as basic filtering (e.g., Gaussian smoothing), Fourier
transform, morphology (e.g., binary erosion), interpolation, and
measurements.
From those functions we can write programs to execute more complex
operations. Scikit-image has fortunately taken on the task of going a step
further to provide more advanced functions that we may need for scientific
research.
These advanced and high-level modules include color space conversion, image
intensity adjustment algorithms, feature detections, filters for sharpening and
denoising, read/write capabilities, and more.
57. (i) Dynamic Threshold
A common application in imaging science is segmenting image components
from one another, which is referred to as thresholding.
The classic thresholding technique works well when the background of the
image is flat. Unfortunately, this situation is not the norm; instead, the
background visually will be changing throughout the image.
Hence, adaptive thresholding techniques have been developed, and we can
easily utilize them in scikit-image.
In the following example, we generate an image with a non-uniform
background that has randomly placed fuzzy dots throughout (see Figure).
58. Then we run a basic and adaptive threshold function on the image to see how
well we can segment the fuzzy dots from the background.
Refer Threshold.py
In this case, as shown in Figure, the adaptive thresholding technique (right
panel) obviously works far better than the basic one (middle panel).
Most of the code above is for generating the image and plotting the output for
context.
The actual code for adaptively thresholding the image took only two lines.
60. (ii) Local Maxima
Approaching a slightly different problem, but with a similar setup as before,
how can we identify points on a non-uniform background to obtain their pixel
coordinates?
Here we can use skimage.morphology.is_local_maximum, which only
needs the image as a default input. The function works surprisingly well; see
Figure, where the identified maxima are circled in blue.
Refer LocalMaxima.py
62. If you look closely at the figure, you will notice that there are identified
maxima that do not point to fuzzy sources but instead to the background
peaks.
These peaks are a problem, but by definition this is what
skimage.morphology.is_local_maximum will find.
How can we filter out these “false positives”? Since we have the coordinates of
the local maxima, we can look for properties that will differentiate the sources
from the rest.
The background is relatively smooth compared to the sources, so we could
differentiate them easily by standard deviation from the peaks to their local
neighboring pixels.
63. How does scikit-image fare with real-world research problems? Quite well, in
fact. In astronomy, the flux per unit area received from stars can be measured
in images by quantifying intensity levels at their locations—a process called
photometry.
Photometry has been done for quite some time in multiple programming
languages, but there is no defacto package for Python yet. The first step in
photometry is identifying the stars.
In the following example, we will use is_local_maximum to identify sources
(hopefully stars) in a stellar cluster called NGC 3603 that was observed with
the Hubble Space Telescope.
Note that one additional package, PyFITS1 is used here. It is a standard
astronomical package for loading binary data stored in FITS2 format.
64. The skimage.morphology.is_local_maximum function returns over
30,000 local maxima in the image, and many of the detections are false
positives.
We apply a simple threshold value to get rid of any maxima peaks that have a
pixel value below 0.5 (from the normalized image) to bring that number down
to roughly 200.
There are much better ways to filter out non-stellar maxima (e.g., noise), but
we will still stick with the current method for simplicity. In Figure we can see
that the detections are good overall.
Refer SourceIdentification.py
65. 2. Scikit-Learn
Possibly the most extensive scikit is scikit-learn. It is an easy-to-use machine
learning bundle that contains a collection of tools associated with supervised
and unsupervised learning.
Some of you may be asking, “So what can machine learning help me do that I
could not do before?” One word: predictions.
Let us assume that we are given a problem where there is a good sample of
empirical data at hand: can predictions be made about it? To figure this out,
we would try to create an analytical model to describe the data, though that
does not always work due to complex dependencies.
But what if you could feed that data to a machine, teach the machine what is
good and bad about the data, and then let it provide its own predictions? That
is what machine learning is. If used right, it can be very powerful.
66. (i) Linear Regression
If we are dealing with data that has a higher number of dimensions, how do
we go about a linear regression solution?
Scikit-learn has a large number of tools to do this, such as Lasso and ridge
regression.
For now we will stick with the ordinary least squares regression function,
which solves mathematical problems of the form
where 𝜔 is the set of coefficients
67. The number of coefficients depends on the number of dimensions in the data,
𝑁 𝑐𝑜𝑒𝑓𝑓 = 𝑀𝐷 − 1, where 𝑀 > 1 and is an integer.
In the example below we are computing the linear regression of a plane in 3D
space, so there are two coefficients to solve for.
Here we show how to use Linear Regression to train the model with data,
approximate a best fit, give a prediction from the data, and test other data
(test) to see how well it fits the model. A visual output of the linear regression
is shown in Figure.
Refer Regression.py
This Linear Regression function can work with much higher dimensions, so
dealing with a larger number of inputs in a model is straightforward.
69. (ii) Clustering
SciPy has two packages for cluster analysis with vector quantization (kmeans)
and hierarchy. The kmeans method was the easier of the two for
implementing and segmenting data into several components based on their
spatial characteristics.
Scikit-learn provides a set of tools to do more cluster analysis that goes
beyond what SciPy has. For a suitable comparison to the kmeans function in
SciPy, the DBSCAN algorithm is used in the following example.
DBSCAN works by finding core points that have many data points within a
given radius
70. Once the core is defined, the process is iteratively computed until there are no
more core points definable within the maximum radius? This algorithm does
exceptionally well compared to kmeans where there is noise present in the
data.
Refer DBSCAN.py
Nearly all the data points originally defined to be part of the clusters are
retained, and the noisy background data points are excluded (see Figure).
This highlights the advantage of DBSCAN over kmeans when data that should
not be part of a cluster is present in a sample.
This obviously is dependent on the spatial characteristics of the given
distributions.
71. Figure: An example of how the DBSCAN algorithm excels over the
vector quantization package in SciPy.