احتمال و یادگیری ماشین
5 subscribers
13 photos
Probability and Machine Learning
Download Telegram
To study, understand, solve problems, and design the functioning of algorithms in data science, machine learning, and deep learning—which are the foundations of artificial intelligence that resembles human intelligence—we need knowledge of basic sciences and computer programming. For computer programming, we need an understanding of different types of data, basic calculations, and advanced programming commands. Various software, applications, and websites have been created to run scientific and entertainment programs based on artificial intelligence, but algorithms may be suitable for one set of data and not precise enough for another, requiring adjustments in parameters and program structure. To become familiar with these topics, solving examples and exercises from books and consulting different resources is necessary. Nowadays, programming has become easier with the help of software, the internet, specialized blogs, and AI search tools. We use:

R 4.4.3 # or Other new version
Python 3.9.13 # Only version 3.
Matlab 2021, with Machine Learning
اهمیت موضوعات مختلف برای انواع یادگیری ماشین

The importance of various topics for different types of machine learning
مقایسه برنامه نویسی و فلوچارت حالت کلاسیک و حالت یادگیری ماشین

Comparison of programming and flowcharts in the classic mode and the machine learning mode
ساختار برنامه نویسی کامپیوتری متحول شده و طبق شکل از حالت کلاسیک به یادگیری ماشین تغییر کرده است. حالت کلاسیک ورودی و روش محاسبات با برنامه نویسی به پاسخ خروجی نتیجه می گردید که به عنوان مثال فلوچارت مجموع اعداد 1 الی n نمایش داده شده است. اما شیوه جدید حالت یادگیری (عمیق) ماشین مثلا بر پایه رگرسیون و شبکه عصبی با داشتن داده ورودی x و احتمالا پاسخ صحیح y به روش یادگیری و فهم ماشین با فرض پارامترهای w,b,β و تابع فعال سازی f موجب خروجی شبکه y ̂ برای مقایسه با پاسخ صحیح است.

The structure of computer programming has evolved and, as shown, has shifted from the classical approach to machine learning. In the classical approach, the input and the computational method via programming led to an output result; for example, a flowchart showing the sum of numbers from 1 to n. However, the new method, the machine learning (deep) approach, for instance based on regression and neural networks, with input data x and possibly the correct output y, uses machine learning and understanding with assumed parameters w, b, β, and an activation function f to produce the network output ŷ for comparison with the correct answer.
انواع داده از نظر ابعاد آن
Types of data in terms of their dimensions
مثال ) آدرس مبنای 16 ذخیره عدد 1 در کامپیوتر را نشان می دهیم.

Example ) We show the hexadecimal address storing the number 1 in the computer.
# Data Science and Machine Learning 
# Seyed Mahmoud Mirkhan, 1404
# Chapter 1 Computer Programming

# R, Show the memory address of the variable and plot a point
library(pryr) # install.packages("pryr")
x <- 1
address(x)
plot(1, col = c("#800080"), pch = 16, cex = 3, xlab = "", ylab = "", axes = FALSE)
# ans: [1] "0x24fb4767780"

# Python, Show the memory address of the variable and plot a point
import matplotlib.pyplot as plt
x = 1
print(f"The memory address of x is: {hex(id(x))}")
x = [1]
y = [0] # You can set y to any value, e.g., 0
# Plot the point with 'o' specifies a circular marker.
plt.plot(x, y, 'o', label='Point (1, 0)')
plt.show()
مثال ) دو عدد را در مبناهای 2 و 16 با یکدیگر جمع می کنیم.

Example ) We add two numbers together in base 2 and base 16
# Data Science and Machine Learning 
# Seyed Mahmoud Mirkhan, 1404
# Chapter 1 Computer Programming

# Python, Sum of two numbers in decimal and binary
num1 = 6
num2 = 13
binary_num1 = bin(num1)[2:] # Remove the '0b' prefix
binary_num2 = bin(num2)[2:]
print(f"Binary of {num1}: {binary_num1}")
print(f"Binary of {num2}: {binary_num2}")
sum_decimal = num1 + num2
binary_sum = bin(sum_decimal)[2:] # Convert the sum to binary
print(f"Sum in decimal: {sum_decimal}")
print(f"Sum in binary: {binary_sum}")

# R, Sum of two hexadecimal numbers as strings
hex1 <- "B2"
hex2 <- "FF"
sum_hex <- as.hexmode(as.numeric(as.hexmode(hex1)) + as.numeric(as.hexmode(hex2)))
print(sum_hex)
انواع مدل یادگیری با نظارت داده برچسب دار تفکیک حیوانات، رگرسیون برازش خط یا صفحه از میان نقاط و مدل یادگیری عمیق تشخیص ارقام دستنویس شناخت تصویر عدد 4 و مدل یادگیری بدون نظارت تفکیک شیرینی
Types of supervised learning models with labeled data for classifying animals, regression models for fitting a line or plane through points, deep learning models for recognizing handwritten digits like the number 4, and unsupervised learning models for classifying pastries.
مثال ) فرض کنید ورودی بردار a=(1 ,-2 ,3) باشد و باید بر روی هر مولفه آن شرط مثبت و منفی بودن را بررسی کنیم. در برنامه نویسی کلاسیک از حلقه و شرط روی اندیس های بردار استفاده می گردید. برای برنامه نویسی با ابزارهای پیشرفته دارای دستورهای کوتاه شده است که برنامه را ساده و خواناتر کرده و نیز سرعت اجرای برنامه سریع تر می گردد.

Example ) Suppose the input vector is a = (1, -2, 3) and we need to check each of its components for being positive or negative. In classical programming, loops and conditionals on the vector indices were used. Advanced programming tools have shortened commands that make the program simpler and more readable, and also increase the execution speed of the program.
# Data Science and Machine Learning 
# Seyed Mahmoud Mirkhan, 1404
# Chapter 1 Computer Programming

# R, Print negative and positive numbers in vector.
a <- c(1, -2, 3)
for(i in 1:3) {
if(a[i] >= 0)
print(paste(a[i], " is positive."))
else
print(paste(a[i], " is negative.")) }

# Python, Print negative and positive numbers in vector.
import numpy as np
a = np.array([1, -2, 3])
for i in np.arange(3):
if(a[i] >= 0):
print(a[i], " is positive.")
else:
print(a[i], " is negative.")

% Matlab, Print negative and positive numbers in vector.
a = [1 -2 3];
for(i = 1:3)
if(a(i) >= 0)
sprintf("%d is positive.", a(i))
else
sprintf("%d is negative.", a(i))
end
end