













































































Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!














































































Artificial intelligence was founded in the 1950s making it a 70-year-old discipline, still young by academic standards. Alan Turing, the British mathematician, is widely regarded as the founding figure of AI, whose work laid the theoretical foundation for the field; o Turing initially referred to the concept as “mechanical intelligence,” reflecting the technological context of the time when computers were essentially mechanical devices; o His core idea was that it might be possible to build machines capable of mimicking the behavior of the human brain; o Turing’s vision of AI, machines imitating the brain, differs from today’s interpretation. Modern AI does not attempt to replicate human emotions or consciousness but rather focuses on experienced based learning and task-oriented intelligence; The early years of AI were dominated by experimental efforts to make machines simulate cognitive tasks rather than to mirror psychology or emotion. One of the first practical applications of AI was in strategy games such as chess, chosen because they involve a finite and well-defined set of rules and moves. This made them particularly suitable for early computational experiments. In chess, every move creates a branching set of possibilities, which can be systematically analyzed; While humans can only anticipate a limited number of future moves due to memory and cognitive constraints, machines can calculate all possible moves and outcomes, exploring every path to determine optimal strategies. As computational power increased, machines could analyze larger numbers of moves more rapidly, eventually surpassing human players. He notes that when computer resources were limited, humans could still win, but as performance improved, machines became unbeatable. This development marked a turning point in AI history, illustrating how advances in hardware capability directly translated into superior machine performance. Following these early successes, AI research centers were established at prominent institutions such as MIT, Stanford, and Boston, focusing on expanding AI into new domains. By the 1960s, efforts turned toward industrial automation and natural language processing (NLP), that is, enabling machines to understand and use human languages. “Natural languages” (like English, Italian, or French) are those used by humans, whereas “artificial languages” (like Python, COBOL, BASIC, or FORTRAN) are programming languages designed for computers. The first natural language processing program was ELIZA, created in 1965. This program simulated a typed conversation between a user and the computer: users entered text and ELIZA generated textual responses; Although naïve and simplistic, the system gave users the illusion of dialogue, the feeling of “talking” to the machine; ELIZA can be compared with today’s conversational systems such as Alexa or Siri, which engage in genuine interaction and understand spoken language, representing a massive leap in complexity and capability. After initial optimism, AI experienced a period of stagnation, often referred to as an “AI winter.” For about 15 years, progress slowed, funding declined, and enthusiasm faded; Researchers found that traditional rule-based systems could not effectively handle real-world problems, which are often uncertain, variable, and context-dependent. This impasse led to the birth of the machine learning paradigm, marking a fundamental shift in the field. In the classical AI approach, problems were encoded as sets of logical rules—rigid “if–then” statements that machines applied deterministically. This approach left no room for uncertainty or adaptation. Machine learning introduced a statistical approach, allowing algorithms to learn patterns from data rather than rely on predefined rules. Machines could now develop their own internal representations and decision
strategies based on experience. This paradigm shift allowed for flexibility, probabilistic reasoning, and an ability to handle the ambiguities of the real world. As a result, a new wave of breakthroughs occurred, giving rise to advanced applications and systems capable of performing previously impossible tasks. Once the machine learning approach took hold, there was an explosion of new developments. Technologies like chatbots, data analysis systems, and intelligent interfaces emerged, allowing for natural human–machine communication in multiple languages. Machine learning began achieving remarkable success in diverse domains—medical diagnostics, image recognition, object detection, and more. By the 2010s and early 2020s, AI had achieved an extraordinary level of capability, becoming integrated into virtually every field of human activity. The adoption and over-resiliance on AI tools can create risks: These systems can act as “oracles,” answering almost any question, but this convenience carries potential danger: people may stop thinking critically and lose essential cognitive skills. Uncritical dependence on AI can lead to intellectual stagnation, an inability to think independently, summarize ideas, or even communicate effectively. AI should serve as an amplifier of human skills, not a replacement for them. Without a solid foundation of knowledge, users risk becoming “slaves to the machine. To avoid this dependency and remain autonomous is to understand how technology works. TURING TEST The Turing Test devised by Alan Turing is a method for determining whether a machine exhibits human-like intelligence. The test involves human evaluator communicating via written text with both a human and a machine, without knowing which is which; If the evaluator cannot reliably distinguish between human and machine responses, the machine is said to have achieved artificial intelligence; In Turing’s time, there were no vocal interfaces, so the test relied exclusively on written communication; Today most advanced AI tools would easily pass the Turing Test, producing text indistinguishable from human writing. This demonstrates how far AI has progressed reaching a level of fluency and coherence that mirrors human communication. IBM Watson is one of the first major demonstrations of AI’s practical success. Developed by IBM roughly 15 years ago, Watson was a question-answering computer system capable of processing natural language input, questions posed in plain English; Watson competed on the American TV quiz show Jeopardy!, where it successfully defeated human champions. This represented a significant milestone in AI’s ability to understand, interpret, and respond to natural language, showcasing the tangible results of decades of research; He notes that Watson’s knowledge base consisted of approximately 200 million pages of text, a number that sounds vast but is modest by today’s standards illustrating both the rapid evolution of AI and the exponential growth in available data; The system operated by interpreting natural language questions and searching for answers within its own knowledge base, which drew on multiple sources such as Wikipedia. Each time a question was posed, Watson analyzed its meaning, searched through its stored data, and generated an appropriate answer. He notes that Watson’s knowledge base, about 200 million pages of text, was surprisingly compact, requiring storage space comparable to a few terabytes, which by today’s standards is quite modest. He humorously observes that many students’ laptops now contain 1–2 terabytes of memory, meaning that a contemporary personal computer could, in principle, host Watson’s data and processing power. This contrast highlights how quickly hardware capabilities have advanced, making what once required supercomputers now feasible on consumer devices. Another major milestone in AI history is AlphaGo, the AI system developed by DeepMind later acquired by Google. While computers had already mastered chess in the 1960s, AlphaGo represented a leap forward because Go is a far more complex game, with an astronomically larger number of possible moves. In just a few years, AlphaGo evolved from beating professional Go players to defeating 9-dan masters, the highest rank in the game, and finally the world champion. This progression occurred within two to three years, marking an unprecedented acceleration in machine performance. AlphaGo combined random search strategies with neural networks, making it one of the first widely recognized applications of deep
The classical approach to AI was based on building logical reasoning chains, where humans explicitly programmed the machine with “if–then” statements. These rules were rigid and could not handle ambiguity or variability. That approach mainly relies on causal relationships. Most recently, machine learning has become the major development of AI. It involves feeding the machine with examples, each described by measurable parameters and associated outcomes. Machine learning favors a statistics-based approach. Through this process, the system learns to associate specific conditions with probable results. For example, if a dataset shows that certain combinations of temperature, pressure, and humidity often precede rain, the machine can learn to predict rainfall without being told explicit meteorological formulas. This statistical learning requires vast quantities of data and high computational power, both of which have become available only in recent decades due to digitalization and massive data collection. The shift from symbolic to statistical AI thus marks the foundation of today’s machine learning era. FEATURES AND TARGET VARIABLES In machine learning there are two fundamental concepts:
During training, the model discovers the mapping from inputs to outputs so that, when presented with new data, it can predict the correct outcome; The quality of this learning process is measured by how well the model minimizes errors, its goal is to make as few mistakes as possible in its predictions. ROLE OF BIG DATA IN MACHINE LEARNING: WHAT IS DRIVING THE RISE OF ML Data availability has a critical role in enabling modern artificial intelligence and machine learning. Infact we have an increasingly growing amount of data available; data are now (nearly) all natively digital. The number of applications and users generating data is continuously increasing. We have data coming from observation platforms (markets), sensors (IoT) and User-generated data. These techniques depend on enormous amounts of examples, often numbering in the hundreds of thousands or millions; The success and spread of machine learning applications are largely due to the explosive growth of data in recent decades. He highlights that this expansion is exponential rather than linear, the total volume of data generated globally continues to increase at an accelerating pace, reaching scales measured in zettabytes, a unit far beyond gigabytes or terabytes. Amount of data in the world Every interaction on the internet, every post, message, or purchase, contributes new data to the global pool. Today, unlike twenty or thirty years ago, individuals are active producers of data, not just consumers. Each online activity adds to the immense datasets that fuel machine learning systems. This continual generation of data provides the raw material for algorithms to learn from and improve. This ongoing growth in data creation is unstoppable and forms one of the key reasons for the success of artificial intelligence and machine learning. The more data machines have access to, the better they can learn patterns, make predictions, and refine their performance.
Example: Customer Classification and Market Segmentation Suppose a company has extensive data about its customers, such as the number of purchases made in the past six months, frequency of purchases, preferred payment methods, and spending ranges. The goal is to segment these customers into groups so that each group can receive targeted marketing strategies. Groups might include, for instance, “affluent customers,” “low- income customers,” “young customers,” or “elderly customers.” Each segment requires a tailored marketing approach, a practice students can observe daily through advertisements and personalized offers. How much data do we generate each day? 500 million tweets; 294 billion emails; 4 million gigabytes of Facebook data; 100 billion WhatsApp messages; 500 hours of new content added every minute on YouTube
We don’t know the number and the characteristics of the groups we are going to analyze. We can distinguish due major types of supervised learning:
in supervised learning, the classes are known in advance (e.g., “diabetic” vs. “non-diabetic”), while in ; unsupervised learning, the structure is discovered through analysis.. In this graph we can see and expanded categorization of ML tasks. Beyond the broad supervised/unsupervised distinction there are multiple subtypes of learning problems. Classification segments the feature space into a number of regions (classes): the output is a class; o We can represent the problem in such a way that there is a separation line between the instances that between to classes (even different between them); o classification problems involve predicting one of a finite set of outcomes and are often representend in 2 dimensions (features)
or thousands of features, but visual demonstrations typically use two.
binary classification is suitable for problems that require a YES/NO answer; we may have multiple output classes instead CLASSIFICATION APPLICATIONS Classification is one of the most widespread applications of machine learning today and gives several concrete examples.
We can elaborate a face recognition example, describing how training data are collected: multiple images of the same person taken under various lighting conditions, angles, and orientations. The task is to train the model so that, when presented with new images, it can correctly identify whether each image belongs to the target individual or to someone else; The evaluation process involves testing the classifier with several images, one of the target person and others of different individuals and observing its outputs. Ideally, the system should respond “yes” for the correct image and “no” for all others. This example highlights the importance of properly framing a classification task, defining the question clearly and determining the exact set of possible classes. In the face recognition scenario, the question is: “Does this new image belong to the individual we’re tracking?” The answer options (classes) are binary: “yes” or “no.” Proper problem framing is crucial because it determines how the model will learn and what kind of output it can produce.
We are going to analyzing several problems in order to correctly categorize them into the types of machine learning tasks. PROBLEM 1- PREDICTING KEY WASTE COLLECTION % You are asked to retrieve some data concerning e-waste collection percentages for a large number of countries. The aim is to predict e-waste collection percentages based on socio-economic indicators such as income per capita or population size. Is this task as classification or regression? we will have a regression with possible values from 0-100%; this is because the task involves predicting a numerical value, not a discrete category. PROBLEM 2- IMAGE CLASSIFICATION (Bicycles, Scooters, Motorbikes) You are asked to retrieve 100 images for each of the following categories: bicycles, scooters, and motorbikes. Then, given a new image, the goal is to determine which category it belongs to. This is classification task with three classes. PROBLEM 3- PREDICTING PASSENGERS SATISFACTION LEVEL The third problem involves datasets derived from passenger satisfaction surveys conducted among airline customers. The goal is to predict satisfaction levels using various predictor variables such as passenger age, type of flight (domestic, international, or transatlantic), and presence of delays. It is a regression because the satisfaction level is a numerical or ordered variable that can take a range of values depending on the scale used, for example, from 0 to 10, 0 to 100%, or 1 to 5/7 on a Likert scale; the specific range depends on how the survey was designed: A satisfaction scale can vary in granularity: a 5-point scale captures coarse satisfaction levels, while a 7-point Likert scale provides finer distinctions; satisfaction is subjective and can depend on different factors for different individuals, such as price, comfort, or timeliness. Although these determinants are outside the scope of the exercise, the goal is to understand the type of machine learning task (regression) and the nature of the target variable (numerical). PROBLEM 4- PREDICTING FLIGHT DELAYS BEYOND 15 MINUTES In the fourth example, students must predict whether a flight will be delayed by more than 15 minutes. it is a classification task, since the answer is binary: either “yes” (the delay exceeds 15 minutes) or “no” (the delay does not); It distinguishes from a regression task because a regression task would instead predict the exact duration of the delay (e.g., 10 minutes, 21 minutes, etc.). Here, since the question is simply whether the delay exceeds a threshold, it qualifies as binary classification. PROBLEM 5- PREDICTING RAINFALL The fifth problem asks students to use various weather observations, such as pressure, temperature, and cloud cover, to predict whether it will rain tomorrow. It is a binary classification task, with the possible outcomes being “yes” (it will rain) or “no” (it will not rain). PROBLEM 6- CUSTOMER SEGMENTATION It involves customer segmentation. The example assumes a UK company that needs to divide its customers into groups and identify high-value customers. there are two separate objectives: segmenting customers and detecting high-value ones, suggesting that the problem may involve different analytical approaches. It is an unsupervised learning, specifically a clustering experience because we do not want a value we only want to divide them into groups; while classification and regression rely on known target labels, clustering requires the algorithm to determine both the number and nature of segments on its own.
Clustering tasks can yield two types of outputs: o Non-overlapping (exclusive) clusters, where each data point (customer) belongs to exactly one segment; o Overlapping clusters, where a customer can belong to multiple segments simultaneously. In fuzzy clustering, membership is not binary (0% or 100%) but gradual, allowing partial belonging to several clusters simultaneously. This technique can make conceptual sense in many contexts, such as marketing, where customers often share characteristics of multiple groups. Ultimately, whether to use non-overlapping or overlapping clusters depends on the specific context and analytical goal. This distinction sets up the following discussion on partitioning versus fuzzy clustering. PROBLEM 7- FORECASTING BIKE RENTALS This example involves a bike rental shop seeking to forecast the number of customers renting bikes at various times — hourly or daily. The predictive features include both environmental variables (such as temperature, rainfall, and weather conditions) and seasonal factors (like time of year). It is a regression problem, since the goal is to predict a numerical quantity — the count of rentals; the target variable’s range as 0 to infinity, since there may be no rentals at certain times but theoretically no upper bound on the number of rentals; If we narrow the range (es. 0-1 or 2-3) the classification transforms into a regression since we have single numbers The distinction between classification and regression is not absolute but continuum. By progressively narrowing the width of the classification ranges, one can make a classification problem behave almost identically to a regression one. For example, if the ranges for bike rentals are made very small — 0–1, 2–3, 4–5, and so on, the classification task becomes practically indistinguishable from regression, even though it is formally defined as a discrete prediction problem; This demonstrates that the two paradigms are conceptually related and that, depending on the granularity of the output variable, a machine-learning task can transition smoothly from classification to regression. PROBLEM 8- PREDICTING TYPES AND OUTCOMES OF CRIMES In the eighth problem, the dataset comes from the San Francisco Police Department, containing crime reports for a specific year. The objective is twofold: Predict the type of crime (e.g., robbery, burglary, or murder); Predict the type of crime resolution (e.g., suspect arrested, suspect killed, unresolved). Predicting the type of crime is a classification task since the target variable consists of discrete categories. Sometimes a single record may involve multiple crimes at once—for instance, a burglary that escalates into a robbery and a murder. In such cases, multiple labels can apply simultaneously; o in this case we can distinguish between scalar output variables, which hold a single value (like a class label or a numerical amount), and vector output variables, which can represent multiple simultaneous outcomes; o In most classification or regression problems discussed so far, the output variable was scalar, a single prediction per input; o However, when multiple labels or outcomes can apply to a single observation, the output becomes a vector, leading to multi-label classification or multi-output prediction. Until now the tasks discussed have involved scalar outputs, meaning that the model produces a single numerical or categorical value for each input. However, in some cases, the target variable may instead be a vector, containing multiple elements.Using the example of predicting crime types in San Francisco, a single incident might involve more than one category of crime, for example, both robbery and battery. In such cases, the output cannot be represented by a single label, but rather by a vector of binary indicators, where each element corresponds to a specific crime type: a value of 1 indicates that the crime type is present, and 0 that it is not. For instance, if only a robbery occurs, the output vector might be [1, 0, 0], whereas a robbery combined with a
o This introduces a distinction between different kinds of variables an essential concept for any data analysis or machine learning pipeline. DATA TYPES BY SOURCE NATURE Data can be classified according to their nature or format. When we discuss the type of data we refer to their nature before the encoding process since after conversion all the data in the digital systems become binary numerical variables:
While these distinctions between text, image, audio, and video describe the source of the data, once data are stored and processed digitally, they all share the same fundamental representation: sequences of bits. In the digital domain, everything becomes numerical even images and sounds are encoded as numeric arrays or strings of bits; Therefore, while it is meaningful to talk about “image data” or “audio data” in terms of their original format, at the computational level, the difference disappears; All data become numerical and machine-readable, making them uniform for processing by algorithms; TYPES OF VARIABLES There are two basic types of variables:
o For instance, sentences like “The dog bit the fox” and “The fox bit the dog” have the same representation in these matrices, even though the meaning differs; These matrices only tell us which words appear, not how they’re ordered; DTM and TDM matrices may have size of thousands rows/columns; o They are also very sparse (high percentage of zeroes) TDM MATRICES DTM MATRICES A DTM matrix is just the transpose of its associated TDM matrix; Each row represents a document; Each column represents a word; numbers represent the frequency of each term in each document. In contrast, a TDM inverts this structure: words appear on the rows, and documents on the columns. ONE-HOT ENCODING: VECTOR-BASED REPRESENTATION One-hot encoding is a method where each word is represented by a vector of zeros, with a single 1 at the position corresponding to that word in the vocabulary; Instead of a matrix, this approach uses a collection of vectors, where each word has its own one-hot vector; o For example, the word "Paris" may be represented as a vector with a 1 in the second position and 0s elsewhere. A basic representation of documents is through the words they contain; Each document is a vector in a vector space; Vector space dimensions are the single words; Each coordinate represents the frequency of that word in the document; Very expensive; Does not preserve semantic distance. Words as vectors Rows represent words; Columns represent documents; Entries represent frequency of words in documents. TDM vs DTM matrices This distinction is purely structural, altering how data is accessed and displayed, but the underlying information remains the same. So, the main difference between the two matrices lies in their orientation, the TDM focuses on terms as rows, while the DTM focuses on documents as rows.
One-hot encoding creates a vector space whose dimensionality equals the vocabulary size. So, if your vocabulary has 50,000 unique words, each one-hot vector has 50,000 components, all zeros except one; These vectors are extremely sparse, and the document is represented as a set of such vectors, with frequency reflected by vector repetition (e.g., a word appearing twice has a vector scaled by two); While conceptually simple, this method is storage-intensive and inefficient. So: Semantically similar words are represented through orthogonal vectors; Their dot product, which can be used as a similarity metric, is zero. Both DTM/TDM matrices and one-hot encodings suffer from the same core problem: they do not capture word meaning or order. Words like "motel" and "hotel", which are clearly related, are treated as completely independent in these systems; As a result, semantic relationships between words are lost, making these representations unhelpful for more sophisticated language tasks like similarity or clustering. WORD EMBEDDING The problem with DTM/TDM (and one-hot encoding) is that they do not consider the position of words in the text, i.e., their context. One-hot encoding does not preserve semantic similarity; To overcome this issue, we can introduce a very popular context-aware encoding is word embedding: a more advanced representation of words as vectors; Unlike one-hot encodings, word embeddings preserve both semantic similarity and contextual relationships; A popular method for generating word embeddings is Word2Vec. This central idea of word embeddings is rooted in the distributional hypothesis, which states that a word's meaning is derived from the context it appears in; Thus, similar contexts imply similar meanings; As a result, word embeddings capture word similarity in their vector representations, and words with related meanings have vectors that are close together in space; If a word has multiple meanings (like “bank”), it may end up with vectors that reflect different contexts. The distributional hypothesis is not mathematically proven, but it works well in practice. In traditional methods like one-hot encoding or DTM, the vector size grows with vocabulary size, which is inefficient; In contrast, word embeddings use fixed-size vectors regardless of how many words are in the vocabulary, making them more compact and scalable. Summary of Key differences Between One-Hot and Word Embeddings In word embeddings like Word2Vec, each word is mapped to a dense vector, and the mapping is learned through algorithms; Unlike one-hot encoding where you arbitrarily assign a 1 to a word’s position, word embeddings are generated to reflect actual word usage and meaning; The idea is that words appearing in similar contexts have similar meanings, an assumption known as the distributional hypothesis.
Each pixel is a tiny element of an image that contains color data. The resolution of an image is determined by the number of horizontal and vertical pixels; o for example, an image that is 500×1000 pixels contain 500,000 individual pixels; Higher resolution means more detail but also requires more storage space; A 20-megapixel image (20 million pixels) will take up far more storage than a 5-megapixel one; Each pixel stores color information, so the more pixels an image has, the more visually detailed and larger the file will be. VECTOR CODING Vector coding represents an image using geometric primitives, lines, curves, shapes, defined mathematically. Vector graphics do not depend on resolution, since shapes are computed at any scale; Common formats: SVG, EPS, AI (Adobe Illustrator). Unlike bitmap images, vector images are not made of pixels. Instead, they are composed of geometric elements such as squares, circles, and curves; Each element is mathematically described by parameters, like coordinates and dimensions; o For example, a square is defined by its corner coordinates, and a circle by its center and radius; This results in a more compact and structured way to encode an image. We have two approaches:
Any visible color could be constructed from the 3 basic colors Red, Green, Blue (RBG). The difference between one color and another depends on the intensity of the RBG components in the color; Therefore, to represent a colored image, each pixel in the image must be represented by 3 different bit patterns. Each of them represents the intensity of the basic colors; The length of a bit pattern representing each basic color is usually 8 bits
Vector coding is widely used in different fields. One major application is in computer-aided design, or CAD, where it is used to create precise technical drawings and engineering models; It is also commonly used in logo and icon design, because vector images can be easily resized and edited without losing quality; Another important use is in data visualization, for creating charts and diagrams that clearly represent information; Finally, vector coding is applied in machine learning preprocessing, especially when working with structured graphical data. REDUNDANCY We can distinguish different types of redundancy: Spatial redundancy: neighboring pixels in a frame are often similar, compression exploits this (like in JPEG); o Even within a single image, areas often have identical pixel values (like a white wall); o Rather than storing each pixel’s value, the same value can be reused across that region. Temporal redundancy: successive frames are similar; o coding can store only changes between frames;
There are also limitations: Vector coding is not suitable for complex natural images, like photographs, because it cannot capture the fine detail and texture of real-world scenes. VIDEO REPRESENTATION Videos are a series of images (frames) shown sequentially (one after another); Thus, video data representation is basically the representation of images changed with time; Video files are multimedia files (also include audio track).
Video coding refers to the process of representing and compressing video data for efficient storage and transmission; Each frame can be treated as a bitmap or vector image, but storing every frame independently is inefficient; The goal of video coding is to reduce redundancy (spatial and temporal) while maintaining acceptable quality.