NIKKI77 commited on
Commit
903b444
·
0 Parent(s):

Deploy: GPU-ready HF Space (Docker)

Browse files
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12-slim
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive PIP_NO_CACHE_DIR=1
4
+ WORKDIR /app
5
+ ENV PYTHONPATH=/app/backend:$PYTHONPATH
6
+
7
+ COPY . .
8
+
9
+ # Install GPU-ready deps
10
+ RUN pip install -r requirements.txt
11
+
12
+ # Preload spaCy + NLTK data so runtime doesn't download
13
+ RUN python -m spacy download en_core_web_sm
14
+ RUN python - <<'PY'
15
+ import nltk
16
+ nltk.download('punkt')
17
+ nltk.download('wordnet')
18
+ nltk.download('omw-1.4')
19
+ PY
20
+
21
+ # HF Spaces uses port 7860
22
+ EXPOSE 7860
23
+
24
+ # Single worker + a few threads = nicer on GPU VRAM
25
+ CMD ["gunicorn","-w","1","-k","gthread","--threads","4","-b","0.0.0.0:7860","backend.app:app"]
backend/__pycache__/autocomplete.cpython-313.pyc ADDED
Binary file (3.44 kB). View file
 
backend/__pycache__/config.cpython-313.pyc ADDED
Binary file (1.55 kB). View file
 
backend/__pycache__/nlp_summary.cpython-313.pyc ADDED
Binary file (1.76 kB). View file
 
backend/__pycache__/punctuation.cpython-313.pyc ADDED
Binary file (1.98 kB). View file
 
backend/__pycache__/semantic_search.cpython-313.pyc ADDED
Binary file (7.56 kB). View file
 
backend/app.py ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Flask app for Subtitle KIS — main routes + search flow
2
+ import os
3
+ import re
4
+ import json as flask_json
5
+ from flask import Flask, render_template, request, jsonify
6
+ from markupsafe import escape, Markup
7
+ from nltk.corpus import wordnet
8
+ from nltk.stem import WordNetLemmatizer
9
+ from semantic_search import search_query
10
+ from nlp_summary import summarize_text
11
+ from autocomplete import get_suggestions
12
+ from config import ABBREVIATION_MAP, VIDEO_METADATA, SEARCH_CONFIG
13
+
14
+ # App setup
15
+ template_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'templates')
16
+ app = Flask(__name__, template_folder=template_dir)
17
+
18
+ # Security headers:Content Security Policy
19
+ @app.after_request
20
+ def apply_csp(response):
21
+ response.headers["Content-Security-Policy"] = (
22
+ "default-src 'self'; "
23
+ "img-src 'self' https://img.youtube.com data:; "
24
+ "script-src 'self' 'unsafe-inline'; "
25
+ "style-src 'self' 'unsafe-inline';"
26
+ )
27
+ return response
28
+
29
+ # Route: Home page
30
+ @app.route("/")
31
+ def index():
32
+ return render_template("index.html")
33
+
34
+ # Template filter: convert HH:MM:SS to seconds
35
+ @app.template_filter("jump_time")
36
+ def jump_time(timestamp):
37
+ try:
38
+ h, m, s = timestamp.split(':')
39
+ total = int(h) * 3600 + int(m) * 60 + int(float(s))
40
+ return max(total - 2, 0)
41
+ except:
42
+ return 0
43
+
44
+ # NLP helpers: lemmatizer + synonym expansion
45
+ lemmatizer = WordNetLemmatizer()
46
+
47
+ def get_synonyms(word):
48
+ """Return a set of synonyms for a single word."""
49
+ synonyms = set()
50
+ for syn in wordnet.synsets(word):
51
+ for lemma in syn.lemmas():
52
+ synonyms.add(lemma.name().replace("_", " "))
53
+ return synonyms
54
+
55
+ # Highlighting:
56
+ def highlight_keywords(text, keyword, semantic_mode=False):
57
+ """
58
+ Highlight exact matches always.
59
+ In semantic mode, also highlight synonyms and lemmas.
60
+ """
61
+ safe_text = escape(text)
62
+
63
+ if len(keyword) <= 3:
64
+ pattern = re.compile(rf"(?<!\w){re.escape(keyword)}(?!\w)", re.IGNORECASE)
65
+ else:
66
+ pattern = re.compile(re.escape(keyword), re.IGNORECASE)
67
+
68
+ if pattern.search(safe_text):
69
+ return pattern.sub(lambda m: f"<mark>{m.group(0)}</mark>", safe_text)
70
+
71
+ # Semantic mode
72
+ if semantic_mode:
73
+ words = keyword.split()
74
+ for w in words:
75
+ lemma = lemmatizer.lemmatize(w.lower())
76
+ candidates = {lemma} | get_synonyms(w)
77
+ for cand in candidates:
78
+ if len(cand) <= 3:
79
+ syn_pattern = re.compile(rf"(?<!\w){re.escape(cand)}(?!\w)", re.IGNORECASE)
80
+ else:
81
+ syn_pattern = re.compile(rf"\b{re.escape(cand)}\b", re.IGNORECASE)
82
+ if syn_pattern.search(safe_text):
83
+ safe_text = syn_pattern.sub(lambda m: f"<mark>{m.group(0)}</mark>", safe_text)
84
+ return safe_text
85
+
86
+ return safe_text
87
+
88
+ # Core search orchestration
89
+ def perform_search(query, start=0, shown=0, previous_results=None, semantic_mode=False):
90
+ """Shared search logic for both HTML and JSON endpoints."""
91
+ if previous_results is None:
92
+ previous_results = []
93
+
94
+
95
+ raw_results, _ = search_query(query, offset=0, top_k=1000, semantic_mode=semantic_mode)
96
+
97
+ # Keyword mode
98
+ if not semantic_mode:
99
+ raw_results = [r for r in raw_results if re.search(re.escape(query), r["text"], re.IGNORECASE)]
100
+
101
+ page_size = SEARCH_CONFIG.get("results_per_page", 5)
102
+ paged_results = raw_results[start:start + page_size]
103
+
104
+ new_results = []
105
+ for idx, r in enumerate(paged_results):
106
+ vid_id = r.get("video_id")
107
+ friendly_key = next((k for k, v in VIDEO_METADATA.items() if v["id"] == vid_id), None)
108
+ r["video_title"] = VIDEO_METADATA.get(friendly_key, {}).get("title", "Unknown Title")
109
+
110
+
111
+ context_chunks = []
112
+ if idx > 0:
113
+ context_chunks.append(paged_results[idx - 1]["summary_input"])
114
+ context_chunks.append(r["summary_input"])
115
+ if idx + 1 < len(paged_results):
116
+ context_chunks.append(paged_results[idx + 1]["summary_input"])
117
+
118
+ summary = summarize_text(" ".join(context_chunks), query=query)
119
+
120
+ highlighted_before = highlight_keywords(r["context_before"], query, semantic_mode)
121
+ highlighted_match = highlight_keywords(r["text"], query, semantic_mode)
122
+ highlighted_after = highlight_keywords(r["context_after"], query, semantic_mode)
123
+
124
+ r["highlighted_block"] = Markup(f"{highlighted_before}\n{highlighted_match}\n{highlighted_after}")
125
+ r["summary"] = summary
126
+ new_results.append(r)
127
+
128
+ combined_results = previous_results + new_results
129
+ shown += len(new_results)
130
+
131
+ return combined_results, len(raw_results), shown, start + len(new_results)
132
+
133
+ # HTML endpoint
134
+ @app.route("/search", methods=["POST"])
135
+ def search():
136
+ query = request.form.get("query", "").strip()
137
+ if not query:
138
+ return render_template("index.html", error="Please enter a search query.")
139
+
140
+ semantic_mode = request.form.get("semantic") == "true"
141
+ start = int(request.form.get("start", 0))
142
+ try:
143
+ previous_results = flask_json.loads(request.form.get("previous_results", "[]"))
144
+ except:
145
+ previous_results = []
146
+
147
+ for r in previous_results:
148
+ if isinstance(r, dict) and "highlighted_block" in r:
149
+ r["highlighted_block"] = Markup(r["highlighted_block"])
150
+
151
+ shown = int(request.form.get("shown", len(previous_results)))
152
+
153
+ combined_results, total_matches, shown, next_start = perform_search(
154
+ query, start, shown, previous_results, semantic_mode
155
+ )
156
+
157
+ # Abbreviation
158
+ suggestion_term = ""
159
+ lower_query = query.lower()
160
+ if lower_query in ABBREVIATION_MAP:
161
+ suggestion_term = ABBREVIATION_MAP[lower_query]
162
+ elif lower_query in ABBREVIATION_MAP.values():
163
+ for abbr, full in ABBREVIATION_MAP.items():
164
+ if full == lower_query:
165
+ suggestion_term = abbr
166
+ break
167
+
168
+ return render_template(
169
+ "results.html",
170
+ query=query,
171
+ results=combined_results,
172
+ shown=shown,
173
+ start=next_start,
174
+ total_matches=total_matches,
175
+ previous_results=combined_results,
176
+ suggestion_term=suggestion_term,
177
+ semantic=semantic_mode
178
+ )
179
+
180
+ # JSON API endpoint
181
+ @app.route("/api/search", methods=["POST"])
182
+ def api_search():
183
+ data = request.get_json(force=True)
184
+ query = data.get("query", "").strip()
185
+ semantic_mode = bool(data.get("semantic", False))
186
+ start = int(data.get("start", 0))
187
+ shown = int(data.get("shown", 0))
188
+ previous_results = data.get("previous_results", [])
189
+
190
+ combined_results, total_matches, shown, next_start = perform_search(
191
+ query, start, shown, previous_results, semantic_mode
192
+ )
193
+
194
+ rendered_cards = [
195
+ render_template("_result_card.html", result=r, query=query, semantic=semantic_mode)
196
+ for r in combined_results[-SEARCH_CONFIG.get("results_per_page", 5):]
197
+ ]
198
+
199
+ return jsonify({
200
+ "html": rendered_cards,
201
+ "shown": shown,
202
+ "total_matches": total_matches,
203
+ "next_start": next_start,
204
+ "has_more": next_start < total_matches
205
+ })
206
+
207
+ # Autocomplete endpoint
208
+ @app.route("/autocomplete", methods=["GET"])
209
+ def autocomplete():
210
+ term = request.args.get("term", "")
211
+ return flask_json.dumps(get_suggestions(term))
212
+
213
+ if __name__ == "__main__":
214
+ app.run(debug=True)
backend/autocomplete.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Autocomplete backend — builds, loads, and queries bigram index
2
+
3
+ import os
4
+ import pickle
5
+ from collections import Counter
6
+
7
+ # Paths: where bigrams.pkl is stored
8
+ BIGRAMS_PATH = os.path.join(os.path.dirname(__file__), "../data/bigrams.pkl")
9
+
10
+ # Global cache (lazy-loaded bigram counts)
11
+ _bigram_counts = None
12
+
13
+ # Build bigrams index from subtitle blocks
14
+ def build_bigrams_index(blocks: list[dict], out_path: str = BIGRAMS_PATH, min_count: int = 2):
15
+ """
16
+ Build a bigram frequency file from preprocessed blocks and save to disk.
17
+ We use a simple whitespace tokenizer and generate bigrams via zip().
18
+ """
19
+ all_text = " ".join((b.get("text") or "").lower() for b in blocks)
20
+ tokens = all_text.split()
21
+ bigrams = [" ".join(pair) for pair in zip(tokens, tokens[1:])]
22
+
23
+ counts = Counter(bigrams)
24
+ if min_count > 1:
25
+ counts = Counter({k: v for k, v in counts.items() if v >= min_count})
26
+
27
+ os.makedirs(os.path.dirname(out_path), exist_ok=True)
28
+ with open(out_path, "wb") as f:
29
+ pickle.dump(counts, f)
30
+
31
+ # Lazy loader for bigrams.pkl into memory
32
+ def load_bigrams():
33
+ """Load precomputed bigrams from disk."""
34
+ global _bigram_counts
35
+ if _bigram_counts is None:
36
+ if os.path.exists(BIGRAMS_PATH):
37
+ with open(BIGRAMS_PATH, "rb") as f:
38
+ _bigram_counts = pickle.load(f)
39
+ else:
40
+ _bigram_counts = Counter()
41
+
42
+ # Suggestion function
43
+ def get_suggestions(term: str):
44
+ """Return top 10 bigram suggestions starting with the given term."""
45
+ if not term or not term.strip():
46
+ return []
47
+ load_bigrams()
48
+ term = term.lower().strip()
49
+ matches = [bg for bg in _bigram_counts if bg.startswith(term)]
50
+ matches.sort(key=lambda x: (-_bigram_counts[x], x))
51
+ return matches[:10]
backend/clean_subtitles.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Subtitle cleaning + preparation — reads .vtt, cleans text, chunks, punctuates, and outputs blocks
2
+ import os
3
+ import re
4
+ import json
5
+ from pathlib import Path
6
+ import webvtt
7
+ import pandas as pd
8
+ from punctuation import punctuate_text
9
+ from config import SUBS_DIR, META_CSV, VIDEO_METADATA, LINES_PER_CHUNK
10
+
11
+ # Helpers
12
+ def clean_text(text: str) -> str:
13
+ """Lowercase, strip tags/brackets, keep basic punctuation, collapse spaces."""
14
+ text = text.lower()
15
+ text = re.sub(r'<.*?>', '', text)
16
+ text = re.sub(r'\[.*?\]', '', text)
17
+ text = re.sub(r"[^a-z0-9.,!?;:'\"()\-\s]", '', text)
18
+ text = re.sub(r'\s+', ' ', text).strip()
19
+ return text
20
+
21
+ def vtt_time_to_seconds(t: str) -> float:
22
+ """Convert WebVTT time ('HH:MM:SS.mmm') to seconds."""
23
+ h, m, s = t.split(':')
24
+ return int(h) * 3600 + int(m) * 60 + float(s)
25
+
26
+ # Main
27
+ def load_and_prepare_subtitles(folder_path: str | os.PathLike, lines_per_chunk: int = LINES_PER_CHUNK):
28
+ """
29
+ Reads .vtt files, cleans captions, chunks by N lines,
30
+ punctuates the WHOLE chunk once, and returns blocks suitable for indexing.
31
+ """
32
+ folder_path = os.fspath(folder_path)
33
+ subtitle_blocks = []
34
+
35
+ for filename in os.listdir(folder_path):
36
+ if not filename.endswith(".vtt"):
37
+ continue
38
+
39
+ stem = Path(filename).stem.strip().lower()
40
+ meta = VIDEO_METADATA.get(stem)
41
+ real_video_id = meta["id"] if meta else None
42
+ if not real_video_id:
43
+ continue
44
+
45
+ filepath = os.path.join(folder_path, filename)
46
+ raw_lines = []
47
+
48
+ # Collect cleaned, unpunctuated lines with original timestamps
49
+ for caption in webvtt.read(filepath):
50
+ cleaned = clean_text(caption.text)
51
+ if cleaned:
52
+ raw_lines.append({
53
+ "timestamp": caption.start,
54
+ "start_sec": vtt_time_to_seconds(caption.start),
55
+ "end_sec": vtt_time_to_seconds(caption.end),
56
+ "text": cleaned,
57
+ "video_id": real_video_id,
58
+ })
59
+
60
+ if not raw_lines:
61
+ continue
62
+
63
+ # Chunk by N lines, then punctuate per chunk
64
+ for i in range(0, len(raw_lines), lines_per_chunk):
65
+ chunk_lines = raw_lines[i:i + lines_per_chunk]
66
+ chunk_raw_text = ""
67
+ for line in chunk_lines:
68
+ text = line["text"].strip()
69
+ if not text:
70
+ continue
71
+ if chunk_raw_text and chunk_raw_text[-1].isalpha() and text[0].isalpha():
72
+ chunk_raw_text += " " + text
73
+ else:
74
+ if chunk_raw_text:
75
+ chunk_raw_text += " "
76
+ chunk_raw_text += text
77
+
78
+ # Punctuate chunk text
79
+ chunk_text = punctuate_text(chunk_raw_text) or chunk_raw_text
80
+
81
+ chunk_start = chunk_lines[0]["start_sec"]
82
+ chunk_end = chunk_lines[-1]["end_sec"]
83
+
84
+ subtitle_blocks.append({
85
+ "text": chunk_text.strip(),
86
+ "video_id": real_video_id,
87
+ "timestamp": chunk_lines[0]["timestamp"],
88
+ "lines": json.dumps(chunk_lines),
89
+ "chunk_start": chunk_start,
90
+ "chunk_end": chunk_end,
91
+ })
92
+
93
+ return subtitle_blocks
94
+
95
+ # process all subs and save META_CSV
96
+ if __name__ == "__main__":
97
+ os.makedirs(os.path.dirname(META_CSV), exist_ok=True)
98
+ blocks = load_and_prepare_subtitles(SUBS_DIR, lines_per_chunk=LINES_PER_CHUNK)
99
+ pd.DataFrame(blocks).to_csv(META_CSV, index=False)
backend/config.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Global configuration — paths, models, metadata, and search settings
2
+ from pathlib import Path
3
+
4
+ # --- Directories & files ---
5
+ ROOT = Path(__file__).resolve().parents[1] # project root (kis_project_v1.1/)
6
+ DATA_DIR = ROOT / "data"
7
+ SUBS_DIR = DATA_DIR / "subtitles"
8
+ META_CSV = DATA_DIR / "metadata.csv"
9
+ INDEX_DIR = DATA_DIR / "embeddings"
10
+ FAISS_PATH = INDEX_DIR / "faiss.index"
11
+
12
+ # --- Models & params
13
+ EMBEDDING_MODEL = "all-MiniLM-L6-v2"
14
+ SUMMARY_MODEL = "sshleifer/distilbart-cnn-12-6"
15
+ LINES_PER_CHUNK = 40
16
+
17
+ # --- Unified video metadata ---
18
+ VIDEO_METADATA = {
19
+ "artificial intelligence": {
20
+ "id": "SSE4M0gcmvE",
21
+ "title": "Introduction to Artificial Intelligence | What Is AI? | Simplilearn"
22
+ },
23
+ "machine learning": {
24
+ "id": "ukzFI9rgwfU",
25
+ "title": "Machine Learning | What Is Machine Learning? | Simplilearn"
26
+ },
27
+ "deep learning": {
28
+ "id": "FbxTVRfQFuI",
29
+ "title": "Deep Learning Explained | Neural Networks | EdX"
30
+ }
31
+ }
32
+
33
+ # --- Abbreviations for app suggestion logic
34
+ ABBREVIATION_MAP = {
35
+ "ml": "machine learning",
36
+ "ai": "artificial intelligence",
37
+ "dl": "deep learning",
38
+ "nn": "neural network",
39
+ "ann": "artificial neural network",
40
+ "cnn": "convolutional neural network",
41
+ "rnn": "recurrent neural network",
42
+ "svm": "support vector machine",
43
+ "knn": "k-nearest neighbors",
44
+ "lr": "logistic regression",
45
+ "gd": "gradient descent",
46
+ "nlp": "natural language processing"
47
+ }
48
+
49
+ # --- Search settings ---
50
+ SEARCH_CONFIG = {
51
+ "embedding_model": EMBEDDING_MODEL,
52
+ "faiss_top_k": 100,
53
+ "results_per_page": 5
54
+ }
backend/embed_index.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Embedding + autocomplete index builder — creates FAISS vector index and bigram index
2
+ import os
3
+ import numpy as np
4
+ import pandas as pd
5
+ import faiss
6
+ from sentence_transformers import SentenceTransformer
7
+ from config import (
8
+ META_CSV,
9
+ INDEX_DIR,
10
+ FAISS_PATH,
11
+ EMBEDDING_MODEL,
12
+ VIDEO_METADATA,
13
+ )
14
+
15
+ # Autocomplete index builder
16
+ from autocomplete import build_bigrams_index, BIGRAMS_PATH
17
+
18
+ # Build FAISS embedding index + bigram autocomplete index
19
+ def build_embedding_index(subtitle_blocks: list[dict]):
20
+ texts = [(s.get("text") or "") for s in subtitle_blocks]
21
+ if not texts:
22
+ raise ValueError("No texts found in subtitle blocks. Did you generate metadata.csv?")
23
+
24
+ model = SentenceTransformer(EMBEDDING_MODEL)
25
+ vectors = model.encode(texts, show_progress_bar=True, convert_to_numpy=True)
26
+
27
+ vectors = np.asarray(vectors, dtype=np.float32)
28
+
29
+ index = faiss.IndexFlatL2(vectors.shape[1])
30
+ index.add(vectors)
31
+
32
+ os.makedirs(INDEX_DIR, exist_ok=True)
33
+ faiss.write_index(index, os.fspath(FAISS_PATH))
34
+
35
+ # Build bigrams for autocomplete
36
+ build_bigrams_index(subtitle_blocks, out_path=BIGRAMS_PATH, min_count=2)
37
+
38
+ # Load subtitle blocks from CSV and with video titles
39
+ def load_blocks_from_csv(csv_path) -> list[dict]:
40
+ df = pd.read_csv(csv_path)
41
+ records = df.to_dict("records")
42
+ for r in records:
43
+ vid = r.get("video_id")
44
+ friendly_key = next((k for k, v in VIDEO_METADATA.items() if v["id"] == vid), None)
45
+ if friendly_key:
46
+ r["video_title"] = VIDEO_METADATA[friendly_key]["title"]
47
+ else:
48
+ r["video_title"] = "Unknown Video"
49
+ return records
50
+
51
+ # build FAISS + autocomplete indexes
52
+ if __name__ == "__main__":
53
+ if not META_CSV.exists():
54
+ raise FileNotFoundError(
55
+ f"metadata.csv not found at {META_CSV}. Run clean_subtitles.py first to generate it."
56
+ )
57
+ blocks = load_blocks_from_csv(META_CSV)
58
+ build_embedding_index(blocks)
backend/nlp_summary.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summarization helper — DistilBART model with punctuation pre-processing
2
+
3
+ from transformers import pipeline
4
+ import torch
5
+ import logging
6
+ from punctuation import punctuate_text
7
+
8
+ # Load summarization model
9
+ device = 0 if torch.cuda.is_available() else -1
10
+ summarizer = pipeline(
11
+ "summarization",
12
+ model="sshleifer/distilbart-cnn-12-6",
13
+ device=device
14
+ )
15
+
16
+ # Summarize text
17
+ def summarize_text(content: str, query: str = "") -> str:
18
+ """
19
+ Summarize already punctuated content, optionally focusing on a query.
20
+ """
21
+ if not content.strip():
22
+ return ""
23
+
24
+ # Ensure content is punctuated before summarizing
25
+ content = punctuate_text(content)
26
+
27
+ # Build summarization input
28
+ if query:
29
+ input_text = f"Summarize the following text focusing on '{query}': {content}"
30
+ else:
31
+ input_text = content
32
+
33
+ try:
34
+ # Token length check (truncate if needed)
35
+ max_input_chars = 3000
36
+ if len(input_text) > max_input_chars:
37
+ input_text = input_text[:max_input_chars] + " [...]"
38
+
39
+ summary = summarizer(
40
+ input_text,
41
+ max_length=150,
42
+ min_length=30,
43
+ do_sample=True,
44
+ top_k=50,
45
+ top_p=0.95,
46
+ temperature=0.9
47
+ )[0]["summary_text"]
48
+
49
+ return summary.strip()
50
+
51
+ except Exception as e:
52
+ logging.error(f"⚠️ Summarization failed: {str(e)}")
53
+ return content[:200] + " [...]" if len(content) > 200 else content
backend/punctuation.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Punctuation restoration — loads Oliver Guhr’s model and restores punctuation in raw text
2
+
3
+ import torch
4
+ from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
5
+
6
+ # Model
7
+ MODEL_NAME = "oliverguhr/fullstop-punctuation-multilang-large"
8
+ DEVICE = 0 if torch.cuda.is_available() else -1
9
+
10
+ print(f"Loading punctuation model ({MODEL_NAME}) on {'GPU' if DEVICE == 0 else 'CPU'}...")
11
+
12
+ # Load tokenizer and model
13
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
14
+ model = AutoModelForTokenClassification.from_pretrained(MODEL_NAME)
15
+
16
+ # pipeline for token classification
17
+ punctuation_pipeline = pipeline(
18
+ "token-classification",
19
+ model=model,
20
+ tokenizer=tokenizer,
21
+ device=DEVICE,
22
+ aggregation_strategy="simple"
23
+ )
24
+
25
+ # Main function
26
+ def punctuate_text(text: str) -> str:
27
+ """
28
+ Restores punctuation in the given text using Oliver Guhr's model.
29
+ Returns the punctuated text.
30
+ """
31
+ if not text.strip():
32
+ return text
33
+
34
+ try:
35
+ results = punctuation_pipeline(text)
36
+
37
+ punctuated_text = ""
38
+ for item in results:
39
+ word = item['word'].replace("▁", " ")
40
+ label = item['entity_group']
41
+
42
+ # Map labels to punctuation marks
43
+ if label == "COMMA":
44
+ punctuated_text += word + ","
45
+ elif label == "PERIOD":
46
+ punctuated_text += word + "."
47
+ elif label == "QUESTION":
48
+ punctuated_text += word + "?"
49
+ else:
50
+ punctuated_text += word
51
+
52
+ # Clean spacing
53
+ return " ".join(punctuated_text.split())
54
+
55
+ except Exception as e:
56
+ print(f"[punctuate_text] Error: {e}")
57
+ return text
backend/semantic_search.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Search engine — supports semantic search (SBERT + FAISS) and keyword search (BM25)
2
+
3
+ import os
4
+ import json
5
+ import re
6
+ import numpy as np
7
+ import pandas as pd
8
+ import faiss
9
+ import torch # ✅ for GPU/CPU auto-detect
10
+ from sentence_transformers import SentenceTransformer
11
+ from config import VIDEO_METADATA, SEARCH_CONFIG
12
+
13
+ # For BM25 keyword ranking
14
+ from rank_bm25 import BM25Okapi
15
+ import nltk
16
+ # ❌ no downloads at import-time in production; ensure 'punkt' is installed in the image
17
+ from nltk.tokenize import word_tokenize
18
+
19
+ # ✅ Auto-select device (GPU on server, CPU locally)
20
+ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
21
+
22
+ # Paths
23
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
24
+ INDEX_PATH = os.path.join(BASE_DIR, "../data/embeddings/faiss.index")
25
+ METADATA_PATH = os.path.join(BASE_DIR, "../data/metadata.csv")
26
+
27
+ # Load model + indexes
28
+ MODEL_NAME = SEARCH_CONFIG.get("embedding_model", "all-MiniLM-L6-v2")
29
+ model = SentenceTransformer(MODEL_NAME, device=DEVICE) # ✅ now uses GPU if available
30
+ faiss_index = faiss.read_index(INDEX_PATH)
31
+ metadata_df = pd.read_csv(METADATA_PATH)
32
+
33
+ # Build BM25 index
34
+ bm25_corpus = []
35
+ bm25_metadata = []
36
+
37
+ for _, row in metadata_df.iterrows():
38
+ lines_raw = json.loads(row["lines"]) if isinstance(row["lines"], str) else row["lines"]
39
+ if not lines_raw:
40
+ continue
41
+ for i, line in enumerate(lines_raw):
42
+ bm25_corpus.append(word_tokenize(line["text"].lower()))
43
+ bm25_metadata.append({
44
+ "text": line["text"].strip(),
45
+ "timestamp": line["timestamp"],
46
+ "video_id": line["video_id"],
47
+ "context_before": lines_raw[i - 1]["text"].strip() if i > 0 else "",
48
+ "context_after": lines_raw[i + 1]["text"].strip() if i + 1 < len(lines_raw) else "",
49
+ "summary_input": row["text"]
50
+ })
51
+
52
+ bm25_index = BM25Okapi(bm25_corpus)
53
+
54
+ # Search function
55
+ def search_query(query, offset=0, top_k=SEARCH_CONFIG.get("results_per_page", 5), semantic_mode=True):
56
+ """
57
+ Search:
58
+ - Semantic mode → SBERT + FAISS + similarity threshold.
59
+ - Keyword mode → BM25 ranking over all subtitle lines.
60
+ """
61
+ if semantic_mode:
62
+ query_vector = model.encode([query])
63
+ faiss_top_k = SEARCH_CONFIG.get("faiss_top_k", 100)
64
+ semantic_threshold = SEARCH_CONFIG.get("semantic_threshold", 0.40)
65
+ semantic_top_n = SEARCH_CONFIG.get("semantic_top_n", 4)
66
+
67
+ # Semantic search with FAISS
68
+ D, I = faiss_index.search(np.array(query_vector), faiss_top_k)
69
+
70
+ all_hits_with_scores = []
71
+ for idx, score in zip(I[0], D[0]):
72
+ current = metadata_df.iloc[idx]
73
+ lines_raw = json.loads(current["lines"]) if isinstance(current["lines"], str) else current["lines"]
74
+
75
+ if not lines_raw:
76
+ continue
77
+
78
+ # Encode all lines in this chunk
79
+ line_texts = [line["text"] for line in lines_raw]
80
+ line_vectors = model.encode(line_texts)
81
+ query_vec = query_vector[0]
82
+ similarities = np.dot(line_vectors, query_vec) / (
83
+ np.linalg.norm(line_vectors, axis=1) * np.linalg.norm(query_vec)
84
+ )
85
+
86
+ line_indices = [i for i, sim in enumerate(similarities) if sim >= semantic_threshold]
87
+ line_indices.sort(key=lambda i: similarities[i], reverse=True)
88
+ line_indices = line_indices[:semantic_top_n]
89
+
90
+ for i in line_indices:
91
+ match_text = lines_raw[i]["text"]
92
+ match_time = lines_raw[i]["timestamp"]
93
+ video_id = lines_raw[i]["video_id"]
94
+ if re.search(re.escape(query), match_text, re.IGNORECASE):
95
+ score -= 0.05
96
+
97
+ friendly_key = next((k for k, v in VIDEO_METADATA.items() if v["id"] == video_id), None)
98
+ video_title = VIDEO_METADATA[friendly_key]["title"] if friendly_key else "Unknown Video"
99
+
100
+ before = lines_raw[i - 1]["text"] if i > 0 else ""
101
+ after = lines_raw[i + 1]["text"] if i + 1 < len(lines_raw) else ""
102
+ summary_block = current["text"]
103
+
104
+ all_hits_with_scores.append((
105
+ score,
106
+ {
107
+ "text": match_text.strip(),
108
+ "context_before": before.strip(),
109
+ "context_after": after.strip(),
110
+ "summary_input": summary_block,
111
+ "timestamp": match_time,
112
+ "video_id": video_id,
113
+ "video_title": video_title
114
+ }
115
+ ))
116
+
117
+ all_hits_with_scores.sort(key=lambda x: x[0])
118
+ sorted_hits = [hit for _, hit in all_hits_with_scores]
119
+ return sorted_hits[offset:offset + top_k], len(sorted_hits)
120
+
121
+ else:
122
+ # Keyword mode: BM25
123
+ tokenized_query = word_tokenize(query.lower())
124
+ scores = bm25_index.get_scores(tokenized_query)
125
+ sorted_indices = np.argsort(scores)[::-1]
126
+
127
+ all_hits_with_scores = []
128
+ for idx in sorted_indices:
129
+ if scores[idx] <= 0:
130
+ continue
131
+
132
+ r = bm25_metadata[idx]
133
+ video_id = r["video_id"]
134
+ friendly_key = next((k for k, v in VIDEO_METADATA.items() if v["id"] == video_id), None)
135
+ video_title = VIDEO_METADATA[friendly_key]["title"] if friendly_key else "Unknown Video"
136
+ r["video_title"] = video_title
137
+
138
+ all_hits_with_scores.append((scores[idx], r))
139
+
140
+ all_hits_with_scores.sort(key=lambda x: x[0], reverse=True)
141
+ sorted_hits = [hit for _, hit in all_hits_with_scores]
142
+ return sorted_hits[offset:offset + top_k], len(sorted_hits)
data/bigrams.pkl ADDED
Binary file (12.9 kB). View file
 
data/embeddings/faiss.index ADDED
Binary file (63 kB). View file
 
data/metadata.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/subtitles/Artificial Intelligence.vtt ADDED
@@ -0,0 +1,1440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WEBVTT - Subtitles by: DownloadYoutubeSubtitles.com
2
+
3
+ 00:00:02.590 --> 00:00:12.400
4
+ [Music]
5
+
6
+ 00:00:10.160 --> 00:00:16.200
7
+ introduction of artificial intelligence
8
+
9
+ 00:00:12.400 --> 00:00:16.200
10
+ and machine learning
11
+
12
+ 00:00:16.640 --> 00:00:21.680
13
+ by the end of this lesson you will be
14
+
15
+ 00:00:18.480 --> 00:00:23.519
16
+ able to define artificial intelligence
17
+
18
+ 00:00:21.680 --> 00:00:26.880
19
+ describe the relationship between
20
+
21
+ 00:00:23.519 --> 00:00:29.439
22
+ artificial intelligence and data science
23
+
24
+ 00:00:26.880 --> 00:00:31.119
25
+ define machine learning
26
+
27
+ 00:00:29.439 --> 00:00:33.440
28
+ describe the relationship between
29
+
30
+ 00:00:31.119 --> 00:00:35.760
31
+ machine learning artificial intelligence
32
+
33
+ 00:00:33.440 --> 00:00:37.760
34
+ and data science
35
+
36
+ 00:00:35.760 --> 00:00:38.960
37
+ describe different machine learning
38
+
39
+ 00:00:37.760 --> 00:00:41.200
40
+ approaches
41
+
42
+ 00:00:38.960 --> 00:00:43.360
43
+ identify the applications of machine
44
+
45
+ 00:00:41.200 --> 00:00:45.280
46
+ learning
47
+
48
+ 00:00:43.360 --> 00:00:48.480
49
+ let's understand how the field of
50
+
51
+ 00:00:45.280 --> 00:00:50.640
52
+ artificial intelligence emerged
53
+
54
+ 00:00:48.480 --> 00:00:52.640
55
+ let's first understand the reason behind
56
+
57
+ 00:00:50.640 --> 00:00:54.719
58
+ the emergence of a.i
59
+
60
+ 00:00:52.640 --> 00:00:57.039
61
+ data economy is one of the factors
62
+
63
+ 00:00:54.719 --> 00:00:59.359
64
+ behind the emergence of ai
65
+
66
+ 00:00:57.039 --> 00:01:01.920
67
+ it refers to how much data has grown
68
+
69
+ 00:00:59.359 --> 00:01:04.239
70
+ over the past few years and how much
71
+
72
+ 00:01:01.920 --> 00:01:06.159
73
+ more it can grow in the coming years
74
+
75
+ 00:01:04.239 --> 00:01:08.320
76
+ when you look at this graph you can
77
+
78
+ 00:01:06.159 --> 00:01:10.000
79
+ clearly understand how the volume of
80
+
81
+ 00:01:08.320 --> 00:01:12.720
82
+ data has grown
83
+
84
+ 00:01:10.000 --> 00:01:15.840
85
+ you can see that since 2009 the data
86
+
87
+ 00:01:12.720 --> 00:01:18.000
88
+ volume has increased by 44 times with
89
+
90
+ 00:01:15.840 --> 00:01:20.560
91
+ the help of social websites
92
+
93
+ 00:01:18.000 --> 00:01:23.119
94
+ the explosion of data has given rise to
95
+
96
+ 00:01:20.560 --> 00:01:25.360
97
+ a new economy and there is a constant
98
+
99
+ 00:01:23.119 --> 00:01:29.040
100
+ battle for ownership of data between
101
+
102
+ 00:01:25.360 --> 00:01:31.119
103
+ companies to derive benefits from it
104
+
105
+ 00:01:29.040 --> 00:01:33.680
106
+ now that you know that data has grown at
107
+
108
+ 00:01:31.119 --> 00:01:36.000
109
+ a rapid pace in the past few years and
110
+
111
+ 00:01:33.680 --> 00:01:38.560
112
+ is going to continue to grow
113
+
114
+ 00:01:36.000 --> 00:01:40.960
115
+ let's understand the need for ai
116
+
117
+ 00:01:38.560 --> 00:01:44.000
118
+ as you know the increase in data volume
119
+
120
+ 00:01:40.960 --> 00:01:46.320
121
+ has given rise to big data which helps
122
+
123
+ 00:01:44.000 --> 00:01:49.520
124
+ manage huge amounts of data
125
+
126
+ 00:01:46.320 --> 00:01:52.000
127
+ data science helps analyze that data so
128
+
129
+ 00:01:49.520 --> 00:01:54.640
130
+ the science associated with data is
131
+
132
+ 00:01:52.000 --> 00:01:56.720
133
+ going toward a new paradigm
134
+
135
+ 00:01:54.640 --> 00:01:59.600
136
+ where one can teach machines to learn
137
+
138
+ 00:01:56.720 --> 00:02:01.840
139
+ from data and drive a variety of useful
140
+
141
+ 00:01:59.600 --> 00:02:04.159
142
+ insights giving rise to artificial
143
+
144
+ 00:02:01.840 --> 00:02:06.840
145
+ intelligence
146
+
147
+ 00:02:04.159 --> 00:02:09.360
148
+ now you may ask what is artificial
149
+
150
+ 00:02:06.840 --> 00:02:11.680
151
+ intelligence artificial intelligence
152
+
153
+ 00:02:09.360 --> 00:02:14.640
154
+ refers to the intelligence displayed by
155
+
156
+ 00:02:11.680 --> 00:02:15.840
157
+ machines that simulates human and animal
158
+
159
+ 00:02:14.640 --> 00:02:18.319
160
+ intelligence
161
+
162
+ 00:02:15.840 --> 00:02:20.400
163
+ it involves intelligence agents
164
+
165
+ 00:02:18.319 --> 00:02:23.120
166
+ the autonomous entities that perceive
167
+
168
+ 00:02:20.400 --> 00:02:25.360
169
+ their environment and take actions that
170
+
171
+ 00:02:23.120 --> 00:02:26.800
172
+ maximize their chances of success at a
173
+
174
+ 00:02:25.360 --> 00:02:28.959
175
+ given goal
176
+
177
+ 00:02:26.800 --> 00:02:31.280
178
+ artificial intelligence is a technique
179
+
180
+ 00:02:28.959 --> 00:02:33.840
181
+ that enables computers to mimic human
182
+
183
+ 00:02:31.280 --> 00:02:36.560
184
+ intelligence using logic
185
+
186
+ 00:02:33.840 --> 00:02:38.400
187
+ it is a program that can sense reason
188
+
189
+ 00:02:36.560 --> 00:02:40.319
190
+ and act
191
+
192
+ 00:02:38.400 --> 00:02:43.200
193
+ let's look at some of the areas where
194
+
195
+ 00:02:40.319 --> 00:02:45.680
196
+ artificial intelligence is used
197
+
198
+ 00:02:43.200 --> 00:02:47.519
199
+ artificial intelligence is redefining
200
+
201
+ 00:02:45.680 --> 00:02:50.480
202
+ industries by providing greater
203
+
204
+ 00:02:47.519 --> 00:02:51.760
205
+ personalization to users and automating
206
+
207
+ 00:02:50.480 --> 00:02:54.000
208
+ processes
209
+
210
+ 00:02:51.760 --> 00:02:57.519
211
+ one example of artificial intelligence
212
+
213
+ 00:02:54.000 --> 00:02:59.360
214
+ in practice is self-driving cars
215
+
216
+ 00:02:57.519 --> 00:03:02.400
217
+ self-driving cars are computer
218
+
219
+ 00:02:59.360 --> 00:03:04.640
220
+ controlled cars that drive themselves
221
+
222
+ 00:03:02.400 --> 00:03:06.800
223
+ in these cars human drivers are never
224
+
225
+ 00:03:04.640 --> 00:03:08.480
226
+ required to take control to safely
227
+
228
+ 00:03:06.800 --> 00:03:11.120
229
+ operate the vehicle
230
+
231
+ 00:03:08.480 --> 00:03:13.599
232
+ these cars are also known as autonomous
233
+
234
+ 00:03:11.120 --> 00:03:16.560
235
+ or driverless cars
236
+
237
+ 00:03:13.599 --> 00:03:19.200
238
+ let's see how apple uses ai
239
+
240
+ 00:03:16.560 --> 00:03:20.879
241
+ iphone users can experience the power of
242
+
243
+ 00:03:19.200 --> 00:03:23.040
244
+ siri the voice
245
+
246
+ 00:03:20.879 --> 00:03:24.800
247
+ it simplifies navigating through your
248
+
249
+ 00:03:23.040 --> 00:03:27.440
250
+ iphone as it listens to your voice
251
+
252
+ 00:03:24.800 --> 00:03:29.599
253
+ commands to perform tasks
254
+
255
+ 00:03:27.440 --> 00:03:32.879
256
+ for instance you can ask siri to call
257
+
258
+ 00:03:29.599 --> 00:03:36.080
259
+ your friend or to play music siri is fun
260
+
261
+ 00:03:32.879 --> 00:03:38.480
262
+ and is extremely convenient to use
263
+
264
+ 00:03:36.080 --> 00:03:40.560
265
+ another example is google's alphago
266
+
267
+ 00:03:38.480 --> 00:03:42.480
268
+ which is a computer program that plays
269
+
270
+ 00:03:40.560 --> 00:03:44.879
271
+ the board game go
272
+
273
+ 00:03:42.480 --> 00:03:47.599
274
+ it is the first computer program to
275
+
276
+ 00:03:44.879 --> 00:03:49.840
277
+ defeat a world champion at the ancient
278
+
279
+ 00:03:47.599 --> 00:03:52.560
280
+ chinese game of go
281
+
282
+ 00:03:49.840 --> 00:03:54.640
283
+ amazon echo is another product it's a
284
+
285
+ 00:03:52.560 --> 00:03:57.120
286
+ home control chatbot device that
287
+
288
+ 00:03:54.640 --> 00:03:59.680
289
+ responds to humans according to what
290
+
291
+ 00:03:57.120 --> 00:04:02.080
292
+ they are saying it responds by playing
293
+
294
+ 00:03:59.680 --> 00:04:04.080
295
+ music movies and more
296
+
297
+ 00:04:02.080 --> 00:04:06.239
298
+ if you've got compatible smart home
299
+
300
+ 00:04:04.080 --> 00:04:09.120
301
+ devices you can tell echo to dim the
302
+
303
+ 00:04:06.239 --> 00:04:11.439
304
+ lights or turn appliances on or off you
305
+
306
+ 00:04:09.120 --> 00:04:14.879
307
+ can use ai and chess and here is an
308
+
309
+ 00:04:11.439 --> 00:04:16.959
310
+ example of a concierge robot from ibm
311
+
312
+ 00:04:14.879 --> 00:04:20.079
313
+ called ibm watson
314
+
315
+ 00:04:16.959 --> 00:04:22.320
316
+ the ibm watson ai has typically been in
317
+
318
+ 00:04:20.079 --> 00:04:26.000
319
+ the headlines for composing music
320
+
321
+ 00:04:22.320 --> 00:04:28.320
322
+ playing chess and even cooking food
323
+
324
+ 00:04:26.000 --> 00:04:30.560
325
+ let's move ahead and look at some sci-fi
326
+
327
+ 00:04:28.320 --> 00:04:32.000
328
+ movies with the concept of artificial
329
+
330
+ 00:04:30.560 --> 00:04:34.320
331
+ intelligence
332
+
333
+ 00:04:32.000 --> 00:04:36.800
334
+ the films featuring ai reflect the
335
+
336
+ 00:04:34.320 --> 00:04:39.520
337
+ ever-changing spectrum of our emotions
338
+
339
+ 00:04:36.800 --> 00:04:41.840
340
+ regarding the machines we have created
341
+
342
+ 00:04:39.520 --> 00:04:44.080
343
+ humans are fascinated by the concept of
344
+
345
+ 00:04:41.840 --> 00:04:46.639
346
+ artificial intelligence and this is
347
+
348
+ 00:04:44.080 --> 00:04:48.240
349
+ reflected in the wide range of movies on
350
+
351
+ 00:04:46.639 --> 00:04:50.800
352
+ ai
353
+
354
+ 00:04:48.240 --> 00:04:53.360
355
+ recommendations systems are used by a
356
+
357
+ 00:04:50.800 --> 00:04:56.160
358
+ lot of e-commerce companies let's see
359
+
360
+ 00:04:53.360 --> 00:04:58.560
361
+ how they work
362
+
363
+ 00:04:56.160 --> 00:05:00.800
364
+ amazon collects data from users and
365
+
366
+ 00:04:58.560 --> 00:05:03.759
367
+ recommends the best product according to
368
+
369
+ 00:05:00.800 --> 00:05:05.520
370
+ the user's buying or shopping pattern
371
+
372
+ 00:05:03.759 --> 00:05:08.720
373
+ for example when you search for a
374
+
375
+ 00:05:05.520 --> 00:05:10.400
376
+ specific product in the amazon store and
377
+
378
+ 00:05:08.720 --> 00:05:12.800
379
+ add it to your cart
380
+
381
+ 00:05:10.400 --> 00:05:14.479
382
+ amazon recommends some relevant products
383
+
384
+ 00:05:12.800 --> 00:05:16.160
385
+ based on your past shopping and
386
+
387
+ 00:05:14.479 --> 00:05:18.479
388
+ searching pattern
389
+
390
+ 00:05:16.160 --> 00:05:20.400
391
+ so before you buy the selected product
392
+
393
+ 00:05:18.479 --> 00:05:22.960
394
+ you get recommendations based on your
395
+
396
+ 00:05:20.400 --> 00:05:25.199
397
+ interest and there is a possibility that
398
+
399
+ 00:05:22.960 --> 00:05:28.240
400
+ you may also buy the relevant product
401
+
402
+ 00:05:25.199 --> 00:05:30.000
403
+ with a selected product if not you have
404
+
405
+ 00:05:28.240 --> 00:05:33.280
406
+ the chance to compare the selected
407
+
408
+ 00:05:30.000 --> 00:05:35.360
409
+ product with the recommended products
410
+
411
+ 00:05:33.280 --> 00:05:37.039
412
+ now let's move ahead and understand the
413
+
414
+ 00:05:35.360 --> 00:05:39.840
415
+ relationship between artificial
416
+
417
+ 00:05:37.039 --> 00:05:42.000
418
+ intelligence machine learning and data
419
+
420
+ 00:05:39.840 --> 00:05:43.680
421
+ science
422
+
423
+ 00:05:42.000 --> 00:05:46.560
424
+ even though the terms artificial
425
+
426
+ 00:05:43.680 --> 00:05:49.520
427
+ intelligence ai machine learning and
428
+
429
+ 00:05:46.560 --> 00:05:51.360
430
+ data science fall in the same domain and
431
+
432
+ 00:05:49.520 --> 00:05:54.160
433
+ are connected to each other they have
434
+
435
+ 00:05:51.360 --> 00:05:56.320
436
+ their specific applications and meaning
437
+
438
+ 00:05:54.160 --> 00:05:58.000
439
+ let's try to understand a little about
440
+
441
+ 00:05:56.320 --> 00:06:00.479
442
+ each of these terms
443
+
444
+ 00:05:58.000 --> 00:06:02.800
445
+ artificial intelligence systems mimic or
446
+
447
+ 00:06:00.479 --> 00:06:04.880
448
+ replicate human intelligence
449
+
450
+ 00:06:02.800 --> 00:06:07.440
451
+ machine learning provides systems the
452
+
453
+ 00:06:04.880 --> 00:06:09.440
454
+ ability to automatically learn and
455
+
456
+ 00:06:07.440 --> 00:06:12.000
457
+ improve from the experiences without
458
+
459
+ 00:06:09.440 --> 00:06:14.160
460
+ being explicitly programmed
461
+
462
+ 00:06:12.000 --> 00:06:17.360
463
+ data science is an umbrella term that
464
+
465
+ 00:06:14.160 --> 00:06:20.240
466
+ encompasses data analytics data mining
467
+
468
+ 00:06:17.360 --> 00:06:22.880
469
+ machine learning artificial intelligence
470
+
471
+ 00:06:20.240 --> 00:06:25.120
472
+ and several other related disciplines
473
+
474
+ 00:06:22.880 --> 00:06:26.960
475
+ let's look at the flow diagram and try
476
+
477
+ 00:06:25.120 --> 00:06:27.919
478
+ to understand the relationship between
479
+
480
+ 00:06:26.960 --> 00:06:30.800
481
+ ai
482
+
483
+ 00:06:27.919 --> 00:06:33.680
484
+ machine learning and data science
485
+
486
+ 00:06:30.800 --> 00:06:35.680
487
+ interestingly ml is also an element of
488
+
489
+ 00:06:33.680 --> 00:06:38.160
490
+ artificial intelligence
491
+
492
+ 00:06:35.680 --> 00:06:40.000
493
+ so the first step is data gathering and
494
+
495
+ 00:06:38.160 --> 00:06:42.319
496
+ data transformation
497
+
498
+ 00:06:40.000 --> 00:06:43.520
499
+ this step basically comes under data
500
+
501
+ 00:06:42.319 --> 00:06:45.600
502
+ science
503
+
504
+ 00:06:43.520 --> 00:06:47.759
505
+ data transformation is the process of
506
+
507
+ 00:06:45.600 --> 00:06:50.080
508
+ converting data from one format or
509
+
510
+ 00:06:47.759 --> 00:06:51.199
511
+ structure into another format or
512
+
513
+ 00:06:50.080 --> 00:06:53.199
514
+ structure
515
+
516
+ 00:06:51.199 --> 00:06:55.759
517
+ data transformation is important to
518
+
519
+ 00:06:53.199 --> 00:06:57.759
520
+ activities such as data management and
521
+
522
+ 00:06:55.759 --> 00:06:59.759
523
+ data integration
524
+
525
+ 00:06:57.759 --> 00:07:02.000
526
+ after gathering data we would want to
527
+
528
+ 00:06:59.759 --> 00:07:04.319
529
+ use the data to make predictions and
530
+
531
+ 00:07:02.000 --> 00:07:06.880
532
+ derive insights in order to get
533
+
534
+ 00:07:04.319 --> 00:07:08.639
535
+ predictions out of the data set we use
536
+
537
+ 00:07:06.880 --> 00:07:11.599
538
+ machine learning techniques such as
539
+
540
+ 00:07:08.639 --> 00:07:14.800
541
+ supervised learning or unsupervised
542
+
543
+ 00:07:11.599 --> 00:07:16.639
544
+ learning on an overview level supervised
545
+
546
+ 00:07:14.800 --> 00:07:18.960
547
+ and unsupervised learning are the
548
+
549
+ 00:07:16.639 --> 00:07:21.199
550
+ machine learning techniques used to
551
+
552
+ 00:07:18.960 --> 00:07:22.400
553
+ extract predictions from a given data
554
+
555
+ 00:07:21.199 --> 00:07:24.880
556
+ set
557
+
558
+ 00:07:22.400 --> 00:07:27.199
559
+ now you must be thinking where deep
560
+
561
+ 00:07:24.880 --> 00:07:29.840
562
+ learning comes into the picture
563
+
564
+ 00:07:27.199 --> 00:07:32.800
565
+ deep learning is a subfield of machine
566
+
567
+ 00:07:29.840 --> 00:07:35.680
568
+ learning involved with algorithms
569
+
570
+ 00:07:32.800 --> 00:07:37.199
571
+ it uses artificial neural networks which
572
+
573
+ 00:07:35.680 --> 00:07:39.199
574
+ are modeled on the structure and
575
+
576
+ 00:07:37.199 --> 00:07:40.560
577
+ performance of neurons in the human
578
+
579
+ 00:07:39.199 --> 00:07:42.880
580
+ brain
581
+
582
+ 00:07:40.560 --> 00:07:45.199
583
+ deep learning is most effective when
584
+
585
+ 00:07:42.880 --> 00:07:46.160
586
+ there isn't a clear structure to the
587
+
588
+ 00:07:45.199 --> 00:07:48.160
589
+ data
590
+
591
+ 00:07:46.160 --> 00:07:49.680
592
+ that you can just exploit and build
593
+
594
+ 00:07:48.160 --> 00:07:52.240
595
+ features around
596
+
597
+ 00:07:49.680 --> 00:07:54.240
598
+ now the next step in the flow diagram is
599
+
600
+ 00:07:52.240 --> 00:07:55.199
601
+ to get insights from predictions being
602
+
603
+ 00:07:54.240 --> 00:07:57.680
604
+ made
605
+
606
+ 00:07:55.199 --> 00:08:00.319
607
+ in order to do so you need to use data
608
+
609
+ 00:07:57.680 --> 00:08:02.400
610
+ analysis which actually is the process
611
+
612
+ 00:08:00.319 --> 00:08:04.080
613
+ under data science
614
+
615
+ 00:08:02.400 --> 00:08:06.240
616
+ now when you are done with all of these
617
+
618
+ 00:08:04.080 --> 00:08:07.280
619
+ you must want your data to perform some
620
+
621
+ 00:08:06.240 --> 00:08:10.160
622
+ actions
623
+
624
+ 00:08:07.280 --> 00:08:12.080
625
+ this is where ai comes into the picture
626
+
627
+ 00:08:10.160 --> 00:08:14.479
628
+ artificial intelligence combines
629
+
630
+ 00:08:12.080 --> 00:08:17.039
631
+ predictions and insights to perform
632
+
633
+ 00:08:14.479 --> 00:08:19.680
634
+ actions based on the human decision and
635
+
636
+ 00:08:17.039 --> 00:08:21.759
637
+ automated decision
638
+
639
+ 00:08:19.680 --> 00:08:23.440
640
+ now let's move ahead and understand the
641
+
642
+ 00:08:21.759 --> 00:08:26.240
643
+ relationship between artificial
644
+
645
+ 00:08:23.440 --> 00:08:28.160
646
+ intelligence machine learning and data
647
+
648
+ 00:08:26.240 --> 00:08:30.000
649
+ science
650
+
651
+ 00:08:28.160 --> 00:08:32.080
652
+ let's look at the relationship between
653
+
654
+ 00:08:30.000 --> 00:08:33.200
655
+ artificial intelligence and machine
656
+
657
+ 00:08:32.080 --> 00:08:35.120
658
+ learning
659
+
660
+ 00:08:33.200 --> 00:08:36.959
661
+ artificial intelligence is the
662
+
663
+ 00:08:35.120 --> 00:08:39.039
664
+ engineering of making intelligent
665
+
666
+ 00:08:36.959 --> 00:08:41.279
667
+ machines and programs
668
+
669
+ 00:08:39.039 --> 00:08:44.080
670
+ machine learning provides systems the
671
+
672
+ 00:08:41.279 --> 00:08:46.959
673
+ ability to learn from past experiences
674
+
675
+ 00:08:44.080 --> 00:08:49.360
676
+ without being explicitly programmed
677
+
678
+ 00:08:46.959 --> 00:08:51.839
679
+ machine learning allows machines to gain
680
+
681
+ 00:08:49.360 --> 00:08:54.839
682
+ intelligence thereby enabling artificial
683
+
684
+ 00:08:51.839 --> 00:08:54.839
685
+ intelligence
686
+
687
+ 00:08:54.959 --> 00:08:58.880
688
+ let's now understand the relationship
689
+
690
+ 00:08:56.800 --> 00:09:00.000
691
+ between machine learning and data
692
+
693
+ 00:08:58.880 --> 00:09:02.160
694
+ science
695
+
696
+ 00:09:00.000 --> 00:09:03.600
697
+ data science and machine learning go
698
+
699
+ 00:09:02.160 --> 00:09:06.320
700
+ hand in hand
701
+
702
+ 00:09:03.600 --> 00:09:08.640
703
+ data science helps evaluate data for
704
+
705
+ 00:09:06.320 --> 00:09:10.640
706
+ machine learning algorithms
707
+
708
+ 00:09:08.640 --> 00:09:13.040
709
+ data science covers the whole spectrum
710
+
711
+ 00:09:10.640 --> 00:09:14.880
712
+ of data processing while machine
713
+
714
+ 00:09:13.040 --> 00:09:18.240
715
+ learning has the algorithmic or
716
+
717
+ 00:09:14.880 --> 00:09:18.240
718
+ statistical aspects
719
+
720
+ 00:09:18.640 --> 00:09:23.839
721
+ data science is the use of statistical
722
+
723
+ 00:09:21.040 --> 00:09:26.080
724
+ methods to find patterns in the data
725
+
726
+ 00:09:23.839 --> 00:09:28.720
727
+ statistical machine learning uses the
728
+
729
+ 00:09:26.080 --> 00:09:31.120
730
+ same techniques as data science
731
+
732
+ 00:09:28.720 --> 00:09:34.000
733
+ data science includes various techniques
734
+
735
+ 00:09:31.120 --> 00:09:37.040
736
+ like statistical modeling visualization
737
+
738
+ 00:09:34.000 --> 00:09:39.440
739
+ and pattern recognition machine learning
740
+
741
+ 00:09:37.040 --> 00:09:44.080
742
+ focuses on developing algorithms from
743
+
744
+ 00:09:39.440 --> 00:09:47.680
745
+ the data provided by making predictions
746
+
747
+ 00:09:44.080 --> 00:09:49.920
748
+ so what is machine learning
749
+
750
+ 00:09:47.680 --> 00:09:52.560
751
+ machine learning is the capability of an
752
+
753
+ 00:09:49.920 --> 00:09:55.360
754
+ artificial intelligence system to learn
755
+
756
+ 00:09:52.560 --> 00:09:57.600
757
+ by extracting patterns from data
758
+
759
+ 00:09:55.360 --> 00:09:59.600
760
+ it usually delivers quicker more
761
+
762
+ 00:09:57.600 --> 00:10:02.480
763
+ accurate results to help you spot
764
+
765
+ 00:09:59.600 --> 00:10:04.399
766
+ profitable opportunities or dangerous
767
+
768
+ 00:10:02.480 --> 00:10:06.399
769
+ risks
770
+
771
+ 00:10:04.399 --> 00:10:09.040
772
+ now you must be curious to understand
773
+
774
+ 00:10:06.399 --> 00:10:11.279
775
+ the features of machine learning machine
776
+
777
+ 00:10:09.040 --> 00:10:14.000
778
+ learning uses the data to detect
779
+
780
+ 00:10:11.279 --> 00:10:16.480
781
+ patterns in a data set and adjust
782
+
783
+ 00:10:14.000 --> 00:10:18.720
784
+ program actions accordingly
785
+
786
+ 00:10:16.480 --> 00:10:20.640
787
+ pattern detection can be defined as the
788
+
789
+ 00:10:18.720 --> 00:10:23.200
790
+ classification of data based on
791
+
792
+ 00:10:20.640 --> 00:10:25.360
793
+ knowledge already gained or on
794
+
795
+ 00:10:23.200 --> 00:10:26.800
796
+ statistical information extracted from
797
+
798
+ 00:10:25.360 --> 00:10:28.640
799
+ the patterns
800
+
801
+ 00:10:26.800 --> 00:10:30.480
802
+ it focuses on the development of
803
+
804
+ 00:10:28.640 --> 00:10:32.480
805
+ computer programs that can teach
806
+
807
+ 00:10:30.480 --> 00:10:34.560
808
+ themselves to grow and change
809
+
810
+ 00:10:32.480 --> 00:10:37.279
811
+ when exposed to new data by using a
812
+
813
+ 00:10:34.560 --> 00:10:39.760
814
+ method called reinforcement learning
815
+
816
+ 00:10:37.279 --> 00:10:42.399
817
+ it uses external feedback to teach the
818
+
819
+ 00:10:39.760 --> 00:10:44.880
820
+ system to change its internal workings
821
+
822
+ 00:10:42.399 --> 00:10:46.880
823
+ in order to guess better next time
824
+
825
+ 00:10:44.880 --> 00:10:49.600
826
+ it enables computers to find hidden
827
+
828
+ 00:10:46.880 --> 00:10:52.640
829
+ insights using iterative algorithms
830
+
831
+ 00:10:49.600 --> 00:10:55.120
832
+ without being explicitly programmed
833
+
834
+ 00:10:52.640 --> 00:10:57.519
835
+ machine learning uses algorithms that
836
+
837
+ 00:10:55.120 --> 00:11:00.399
838
+ learn from previous data to help produce
839
+
840
+ 00:10:57.519 --> 00:11:02.640
841
+ reliable and repeatable decisions it
842
+
843
+ 00:11:00.399 --> 00:11:04.560
844
+ automates analytical model building
845
+
846
+ 00:11:02.640 --> 00:11:07.360
847
+ using the statistical and machine
848
+
849
+ 00:11:04.560 --> 00:11:10.240
850
+ learning algorithms that tease patterns
851
+
852
+ 00:11:07.360 --> 00:11:13.200
853
+ and relationships from data and express
854
+
855
+ 00:11:10.240 --> 00:11:15.120
856
+ them as mathematical equations
857
+
858
+ 00:11:13.200 --> 00:11:18.160
859
+ let's understand the different machine
860
+
861
+ 00:11:15.120 --> 00:11:18.160
862
+ learning approaches
863
+
864
+ 00:11:18.880 --> 00:11:23.519
865
+ so what is the actual difference between
866
+
867
+ 00:11:21.519 --> 00:11:26.560
868
+ traditional programming and machine
869
+
870
+ 00:11:23.519 --> 00:11:27.360
871
+ learning in traditional programming data
872
+
873
+ 00:11:26.560 --> 00:11:30.320
874
+ and
875
+
876
+ 00:11:27.360 --> 00:11:32.720
877
+ is provided to the computer it processes
878
+
879
+ 00:11:30.320 --> 00:11:34.560
880
+ them and gives the output however the
881
+
882
+ 00:11:32.720 --> 00:11:37.360
883
+ machine learning approach is very
884
+
885
+ 00:11:34.560 --> 00:11:40.959
886
+ different in machine learning algorithms
887
+
888
+ 00:11:37.360 --> 00:11:43.360
889
+ are applied on the given data and output
890
+
891
+ 00:11:40.959 --> 00:11:46.000
892
+ the result of the applied algorithm and
893
+
894
+ 00:11:43.360 --> 00:11:49.360
895
+ calculations is a learning model that
896
+
897
+ 00:11:46.000 --> 00:11:51.680
898
+ helps machine to learn from the data
899
+
900
+ 00:11:49.360 --> 00:11:54.320
901
+ in traditional programming you code the
902
+
903
+ 00:11:51.680 --> 00:11:56.560
904
+ behavior of the program but in machine
905
+
906
+ 00:11:54.320 --> 00:11:59.120
907
+ learning you leave a lot of that to the
908
+
909
+ 00:11:56.560 --> 00:12:00.560
910
+ machine to learn from data
911
+
912
+ 00:11:59.120 --> 00:12:03.040
913
+ now let's first understand the
914
+
915
+ 00:12:00.560 --> 00:12:05.040
916
+ traditional programming approach
917
+
918
+ 00:12:03.040 --> 00:12:07.680
919
+ traditionally you would hard code the
920
+
921
+ 00:12:05.040 --> 00:12:10.320
922
+ decision rules for a problem at hand
923
+
924
+ 00:12:07.680 --> 00:12:12.240
925
+ evaluate the results of the program and
926
+
927
+ 00:12:10.320 --> 00:12:15.279
928
+ if the results were satisfactory the
929
+
930
+ 00:12:12.240 --> 00:12:17.680
931
+ program would be deployed in production
932
+
933
+ 00:12:15.279 --> 00:12:20.079
934
+ if the results were not as expected one
935
+
936
+ 00:12:17.680 --> 00:12:22.720
937
+ would review the errors change the
938
+
939
+ 00:12:20.079 --> 00:12:25.279
940
+ program and evaluate it again
941
+
942
+ 00:12:22.720 --> 00:12:28.800
943
+ this iterative process continues till
944
+
945
+ 00:12:25.279 --> 00:12:31.200
946
+ one gets the expected result
947
+
948
+ 00:12:28.800 --> 00:12:33.120
949
+ what is the machine learning approach in
950
+
951
+ 00:12:31.200 --> 00:12:35.920
952
+ the new machine learning approach the
953
+
954
+ 00:12:33.120 --> 00:12:38.240
955
+ decision rules are not hard coded the
956
+
957
+ 00:12:35.920 --> 00:12:40.160
958
+ problem is solved by training a model
959
+
960
+ 00:12:38.240 --> 00:12:43.279
961
+ with the training data in order to
962
+
963
+ 00:12:40.160 --> 00:12:45.760
964
+ derive or learn an algorithm that best
965
+
966
+ 00:12:43.279 --> 00:12:48.639
967
+ represents the relationship between the
968
+
969
+ 00:12:45.760 --> 00:12:51.680
970
+ input and the output this trained model
971
+
972
+ 00:12:48.639 --> 00:12:53.839
973
+ is then evaluated against test data if
974
+
975
+ 00:12:51.680 --> 00:12:56.160
976
+ the results were satisfactory the model
977
+
978
+ 00:12:53.839 --> 00:12:58.160
979
+ would be deployed in production and if
980
+
981
+ 00:12:56.160 --> 00:13:01.920
982
+ the results are not satisfactory the
983
+
984
+ 00:12:58.160 --> 00:13:05.360
985
+ training is repeated with some changes
986
+
987
+ 00:13:01.920 --> 00:13:05.360
988
+ machine learning techniques
989
+
990
+ 00:13:05.600 --> 00:13:09.360
991
+ machine learning uses a number of
992
+
993
+ 00:13:07.600 --> 00:13:12.079
994
+ theories and techniques from data
995
+
996
+ 00:13:09.360 --> 00:13:14.839
997
+ science here are some machine learning
998
+
999
+ 00:13:12.079 --> 00:13:18.480
1000
+ techniques classification
1001
+
1002
+ 00:13:14.839 --> 00:13:21.440
1003
+ categorization clustering trend analysis
1004
+
1005
+ 00:13:18.480 --> 00:13:22.959
1006
+ anomaly detection visualization and
1007
+
1008
+ 00:13:21.440 --> 00:13:26.079
1009
+ decision making
1010
+
1011
+ 00:13:22.959 --> 00:13:28.160
1012
+ let's look at these techniques
1013
+
1014
+ 00:13:26.079 --> 00:13:30.160
1015
+ classification is a technique in which
1016
+
1017
+ 00:13:28.160 --> 00:13:33.360
1018
+ the computer program learns from the
1019
+
1020
+ 00:13:30.160 --> 00:13:35.040
1021
+ data input given to it and then uses
1022
+
1023
+ 00:13:33.360 --> 00:13:36.639
1024
+ this learning to classify new
1025
+
1026
+ 00:13:35.040 --> 00:13:38.959
1027
+ observations
1028
+
1029
+ 00:13:36.639 --> 00:13:41.839
1030
+ classification is used for predicting
1031
+
1032
+ 00:13:38.959 --> 00:13:44.000
1033
+ discrete responses classification is
1034
+
1035
+ 00:13:41.839 --> 00:13:48.360
1036
+ used when we are training a model to
1037
+
1038
+ 00:13:44.000 --> 00:13:50.399
1039
+ predict qualitative targets
1040
+
1041
+ 00:13:48.360 --> 00:13:52.959
1042
+ categorization is a technique of
1043
+
1044
+ 00:13:50.399 --> 00:13:55.440
1045
+ organizing data into categories for its
1046
+
1047
+ 00:13:52.959 --> 00:13:57.839
1048
+ most effective and efficient use
1049
+
1050
+ 00:13:55.440 --> 00:14:00.959
1051
+ it makes free text searches faster and
1052
+
1053
+ 00:13:57.839 --> 00:14:03.279
1054
+ provides a better user experience
1055
+
1056
+ 00:14:00.959 --> 00:14:05.120
1057
+ clustering is a technique of grouping a
1058
+
1059
+ 00:14:03.279 --> 00:14:07.199
1060
+ set of objects in such a way that
1061
+
1062
+ 00:14:05.120 --> 00:14:09.600
1063
+ objects in the same group are most
1064
+
1065
+ 00:14:07.199 --> 00:14:10.880
1066
+ similar to each other than to those in
1067
+
1068
+ 00:14:09.600 --> 00:14:13.120
1069
+ other groups
1070
+
1071
+ 00:14:10.880 --> 00:14:14.959
1072
+ it is basically a collection of objects
1073
+
1074
+ 00:14:13.120 --> 00:14:18.000
1075
+ on the basis of similarity and
1076
+
1077
+ 00:14:14.959 --> 00:14:20.320
1078
+ dissimilarity between them
1079
+
1080
+ 00:14:18.000 --> 00:14:22.240
1081
+ trend analysis is a technique aimed at
1082
+
1083
+ 00:14:20.320 --> 00:14:24.639
1084
+ projecting both current and future
1085
+
1086
+ 00:14:22.240 --> 00:14:27.279
1087
+ movement of events through the use of
1088
+
1089
+ 00:14:24.639 --> 00:14:29.440
1090
+ time series data analysis
1091
+
1092
+ 00:14:27.279 --> 00:14:32.399
1093
+ it represents variations of low
1094
+
1095
+ 00:14:29.440 --> 00:14:36.399
1096
+ frequency in a time series the high and
1097
+
1098
+ 00:14:32.399 --> 00:14:38.880
1099
+ medium frequency fluctuations being out
1100
+
1101
+ 00:14:36.399 --> 00:14:41.519
1102
+ anomaly detection is a technique to
1103
+
1104
+ 00:14:38.880 --> 00:14:44.560
1105
+ identify cases that are unusual within
1106
+
1107
+ 00:14:41.519 --> 00:14:46.639
1108
+ data that is seemingly homogenous
1109
+
1110
+ 00:14:44.560 --> 00:14:48.720
1111
+ anomaly detection can be a key for
1112
+
1113
+ 00:14:46.639 --> 00:14:51.360
1114
+ solving intrusions by indicating a
1115
+
1116
+ 00:14:48.720 --> 00:14:55.639
1117
+ presence of intended or unintended
1118
+
1119
+ 00:14:51.360 --> 00:14:58.000
1120
+ induced attacks defects faults and so on
1121
+
1122
+ 00:14:55.639 --> 00:15:01.680
1123
+ visualization is a technique to present
1124
+
1125
+ 00:14:58.000 --> 00:15:03.760
1126
+ data in a pictorial or graphical format
1127
+
1128
+ 00:15:01.680 --> 00:15:06.320
1129
+ it enables decision makers to see
1130
+
1131
+ 00:15:03.760 --> 00:15:08.399
1132
+ analytics presented visually
1133
+
1134
+ 00:15:06.320 --> 00:15:10.880
1135
+ when data is shown in the form of
1136
+
1137
+ 00:15:08.399 --> 00:15:12.480
1138
+ pictures it becomes easy for users to
1139
+
1140
+ 00:15:10.880 --> 00:15:14.639
1141
+ understand it
1142
+
1143
+ 00:15:12.480 --> 00:15:16.560
1144
+ decision making is a technique or skill
1145
+
1146
+ 00:15:14.639 --> 00:15:19.600
1147
+ that provides you with the ability to
1148
+
1149
+ 00:15:16.560 --> 00:15:22.800
1150
+ influence managerial decisions with data
1151
+
1152
+ 00:15:19.600 --> 00:15:24.720
1153
+ as evidence for those possibilities
1154
+
1155
+ 00:15:22.800 --> 00:15:26.800
1156
+ now i am sure you have a better
1157
+
1158
+ 00:15:24.720 --> 00:15:29.120
1159
+ understanding of the overview of machine
1160
+
1161
+ 00:15:26.800 --> 00:15:31.680
1162
+ learning so let's look at some real-time
1163
+
1164
+ 00:15:29.120 --> 00:15:33.839
1165
+ applications of machine learning
1166
+
1167
+ 00:15:31.680 --> 00:15:36.160
1168
+ artificial intelligence and machine
1169
+
1170
+ 00:15:33.839 --> 00:15:38.320
1171
+ learning are being increasingly used in
1172
+
1173
+ 00:15:36.160 --> 00:15:40.399
1174
+ various functions such as image
1175
+
1176
+ 00:15:38.320 --> 00:15:44.079
1177
+ processing robotics
1178
+
1179
+ 00:15:40.399 --> 00:15:46.399
1180
+ data mining video games text analysis
1181
+
1182
+ 00:15:44.079 --> 00:15:48.320
1183
+ and healthcare let's look at each of
1184
+
1185
+ 00:15:46.399 --> 00:15:51.199
1186
+ them in more details
1187
+
1188
+ 00:15:48.320 --> 00:15:53.279
1189
+ so what is image processing it is a
1190
+
1191
+ 00:15:51.199 --> 00:15:55.519
1192
+ technique to convert an image into a
1193
+
1194
+ 00:15:53.279 --> 00:15:58.160
1195
+ digital format and perform some
1196
+
1197
+ 00:15:55.519 --> 00:16:00.560
1198
+ operations on it so as to induce an
1199
+
1200
+ 00:15:58.160 --> 00:16:02.800
1201
+ enhanced image or to extract some
1202
+
1203
+ 00:16:00.560 --> 00:16:04.720
1204
+ helpful information from it
1205
+
1206
+ 00:16:02.800 --> 00:16:06.399
1207
+ let's look at some of the examples of
1208
+
1209
+ 00:16:04.720 --> 00:16:08.880
1210
+ image processing
1211
+
1212
+ 00:16:06.399 --> 00:16:10.959
1213
+ facebook does automatic face tagging by
1214
+
1215
+ 00:16:08.880 --> 00:16:14.000
1216
+ recognizing a face from a previous
1217
+
1218
+ 00:16:10.959 --> 00:16:15.839
1219
+ user's tagged photos another example is
1220
+
1221
+ 00:16:14.000 --> 00:16:19.279
1222
+ optional character recognition which
1223
+
1224
+ 00:16:15.839 --> 00:16:21.040
1225
+ scans printed docs to digitize the text
1226
+
1227
+ 00:16:19.279 --> 00:16:23.360
1228
+ self-driving cars are another big
1229
+
1230
+ 00:16:21.040 --> 00:16:26.079
1231
+ example of image processing
1232
+
1233
+ 00:16:23.360 --> 00:16:27.839
1234
+ autopilot is an optional drive system
1235
+
1236
+ 00:16:26.079 --> 00:16:30.399
1237
+ for tesla cars
1238
+
1239
+ 00:16:27.839 --> 00:16:34.160
1240
+ when autopilot is engaged cars can
1241
+
1242
+ 00:16:30.399 --> 00:16:37.680
1243
+ self-steer adjust speed detect nearby
1244
+
1245
+ 00:16:34.160 --> 00:16:40.079
1246
+ obstacles apply the brakes and park
1247
+
1248
+ 00:16:37.680 --> 00:16:41.040
1249
+ now let's see how robotics uses machine
1250
+
1251
+ 00:16:40.079 --> 00:16:43.120
1252
+ learning
1253
+
1254
+ 00:16:41.040 --> 00:16:44.720
1255
+ robots are machines that can be used to
1256
+
1257
+ 00:16:43.120 --> 00:16:47.199
1258
+ do certain jobs
1259
+
1260
+ 00:16:44.720 --> 00:16:49.199
1261
+ some of the examples of robotics are
1262
+
1263
+ 00:16:47.199 --> 00:16:52.079
1264
+ where a humanoid robot can read the
1265
+
1266
+ 00:16:49.199 --> 00:16:54.079
1267
+ emotions of human beings or
1268
+
1269
+ 00:16:52.079 --> 00:16:57.040
1270
+ an industrial robot is used for
1271
+
1272
+ 00:16:54.079 --> 00:16:58.880
1273
+ assembling and manufacturing products
1274
+
1275
+ 00:16:57.040 --> 00:17:01.360
1276
+ so let's look at some real-time
1277
+
1278
+ 00:16:58.880 --> 00:17:04.880
1279
+ applications of machine learning
1280
+
1281
+ 00:17:01.360 --> 00:17:07.199
1282
+ let's see what data mining is it is the
1283
+
1284
+ 00:17:04.880 --> 00:17:08.160
1285
+ method of analyzing hidden patterns in
1286
+
1287
+ 00:17:07.199 --> 00:17:10.160
1288
+ data
1289
+
1290
+ 00:17:08.160 --> 00:17:11.679
1291
+ let's look at some of the applications
1292
+
1293
+ 00:17:10.160 --> 00:17:13.919
1294
+ of data mining
1295
+
1296
+ 00:17:11.679 --> 00:17:16.000
1297
+ it is used for anomaly detection to
1298
+
1299
+ 00:17:13.919 --> 00:17:18.720
1300
+ detect credit card fraud and to
1301
+
1302
+ 00:17:16.000 --> 00:17:21.839
1303
+ determine which transactions vary from
1304
+
1305
+ 00:17:18.720 --> 00:17:24.160
1306
+ usual purchasing patterns
1307
+
1308
+ 00:17:21.839 --> 00:17:26.799
1309
+ it is also used in market basket
1310
+
1311
+ 00:17:24.160 --> 00:17:30.559
1312
+ analysis which is used to detect which
1313
+
1314
+ 00:17:26.799 --> 00:17:30.559
1315
+ items are often bought together
1316
+
1317
+ 00:17:31.679 --> 00:17:38.720
1318
+ it can be used for grouping where it
1319
+
1320
+ 00:17:33.679 --> 00:17:38.720
1321
+ classifies users based on their profiles
1322
+
1323
+ 00:17:38.799 --> 00:17:43.280
1324
+ machine learning is also applied in many
1325
+
1326
+ 00:17:41.039 --> 00:17:46.799
1327
+ video games in order to give predictions
1328
+
1329
+ 00:17:43.280 --> 00:17:48.640
1330
+ based on data in a pokemon go battle
1331
+
1332
+ 00:17:46.799 --> 00:17:50.480
1333
+ there is a lot of data to take into
1334
+
1335
+ 00:17:48.640 --> 00:17:51.760
1336
+ account to correctly predict the winner
1337
+
1338
+ 00:17:50.480 --> 00:17:53.600
1339
+ of a battle
1340
+
1341
+ 00:17:51.760 --> 00:17:56.000
1342
+ and this is where machine learning
1343
+
1344
+ 00:17:53.600 --> 00:17:58.400
1345
+ becomes useful a machine learning
1346
+
1347
+ 00:17:56.000 --> 00:18:01.280
1348
+ classifier will predict the result of
1349
+
1350
+ 00:17:58.400 --> 00:18:03.520
1351
+ the match based on this data
1352
+
1353
+ 00:18:01.280 --> 00:18:05.440
1354
+ let's move on to one of the most popular
1355
+
1356
+ 00:18:03.520 --> 00:18:07.360
1357
+ applications of machine learning which
1358
+
1359
+ 00:18:05.440 --> 00:18:09.919
1360
+ is text analysis
1361
+
1362
+ 00:18:07.360 --> 00:18:11.840
1363
+ it is the automated process of obtaining
1364
+
1365
+ 00:18:09.919 --> 00:18:14.640
1366
+ information from text
1367
+
1368
+ 00:18:11.840 --> 00:18:17.600
1369
+ one example of text analysis is spam
1370
+
1371
+ 00:18:14.640 --> 00:18:19.039
1372
+ filtering which is used to detect spam
1373
+
1374
+ 00:18:17.600 --> 00:18:21.440
1375
+ in emails
1376
+
1377
+ 00:18:19.039 --> 00:18:24.160
1378
+ another example is sentimental analysis
1379
+
1380
+ 00:18:21.440 --> 00:18:26.400
1381
+ which is used for classifying an opinion
1382
+
1383
+ 00:18:24.160 --> 00:18:28.799
1384
+ as positive negative or neutral it
1385
+
1386
+ 00:18:26.400 --> 00:18:31.360
1387
+ detects public sentiment in twitter feed
1388
+
1389
+ 00:18:28.799 --> 00:18:33.280
1390
+ or filters customer complaints
1391
+
1392
+ 00:18:31.360 --> 00:18:36.320
1393
+ it is also used for information
1394
+
1395
+ 00:18:33.280 --> 00:18:40.880
1396
+ extraction such as extracting specific
1397
+
1398
+ 00:18:36.320 --> 00:18:40.880
1399
+ data address keyword or entities
1400
+
1401
+ 00:18:41.200 --> 00:18:45.520
1402
+ there are many applications of machine
1403
+
1404
+ 00:18:43.280 --> 00:18:48.720
1405
+ learning in the healthcare industry
1406
+
1407
+ 00:18:45.520 --> 00:18:51.600
1408
+ identifying disease and diagnosis
1409
+
1410
+ 00:18:48.720 --> 00:18:54.400
1411
+ drug discovery and manufacturing medical
1412
+
1413
+ 00:18:51.600 --> 00:18:56.320
1414
+ imaging diagnosis and so on
1415
+
1416
+ 00:18:54.400 --> 00:18:58.480
1417
+ some of the companies that use machine
1418
+
1419
+ 00:18:56.320 --> 00:19:01.200
1420
+ learning have revolutionized the health
1421
+
1422
+ 00:18:58.480 --> 00:19:02.160
1423
+ care industry are google deep mind
1424
+
1425
+ 00:19:01.200 --> 00:19:06.320
1426
+ health
1427
+
1428
+ 00:19:02.160 --> 00:19:08.430
1429
+ bio beats health fidelity and ginger dot
1430
+
1431
+ 00:19:06.320 --> 00:19:12.880
1432
+ io
1433
+
1434
+ 00:19:08.430 --> 00:19:14.960
1435
+ [Music]
1436
+
1437
+ 00:19:12.880 --> 00:19:14.960
1438
+ you
1439
+
1440
+
data/subtitles/Deep Learning.vtt ADDED
@@ -0,0 +1,2757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WEBVTT - Subtitles by: DownloadYoutubeSubtitles.com
2
+
3
+ 00:00:03.040 --> 00:00:08.960
4
+ hello and welcome to the session on deep
5
+
6
+ 00:00:05.920 --> 00:00:11.599
7
+ learning my name is mohan and in this
8
+
9
+ 00:00:08.960 --> 00:00:14.080
10
+ video we are going to talk about what
11
+
12
+ 00:00:11.599 --> 00:00:16.160
13
+ deep learning is all about some of you
14
+
15
+ 00:00:14.080 --> 00:00:19.520
16
+ may be already familiar with the image
17
+
18
+ 00:00:16.160 --> 00:00:22.640
19
+ recognition how does image recognition
20
+
21
+ 00:00:19.520 --> 00:00:25.680
22
+ work you can train this application or
23
+
24
+ 00:00:22.640 --> 00:00:28.080
25
+ your machine to recognize whether a
26
+
27
+ 00:00:25.680 --> 00:00:30.080
28
+ given image is a cat or a dog and this
29
+
30
+ 00:00:28.080 --> 00:00:32.239
31
+ is how it works at a very high level it
32
+
33
+ 00:00:30.080 --> 00:00:34.480
34
+ uses artificial neural network it is
35
+
36
+ 00:00:32.239 --> 00:00:36.559
37
+ trained with some known images and
38
+
39
+ 00:00:34.480 --> 00:00:38.960
40
+ during the training it is told if it is
41
+
42
+ 00:00:36.559 --> 00:00:41.040
43
+ recognizing correctly or not and then
44
+
45
+ 00:00:38.960 --> 00:00:42.960
46
+ when new images are submitted it
47
+
48
+ 00:00:41.040 --> 00:00:45.680
49
+ recognizes correctly based on the
50
+
51
+ 00:00:42.960 --> 00:00:47.600
52
+ accuracy of course so a little quick
53
+
54
+ 00:00:45.680 --> 00:00:50.480
55
+ understanding about artificial neural
56
+
57
+ 00:00:47.600 --> 00:00:53.600
58
+ networks so this is the way it does is
59
+
60
+ 00:00:50.480 --> 00:00:56.000
61
+ you provide a lot of training data also
62
+
63
+ 00:00:53.600 --> 00:00:59.359
64
+ known as labeled data for example in
65
+
66
+ 00:00:56.000 --> 00:01:02.640
67
+ this case these are the images of dogs
68
+
69
+ 00:00:59.359 --> 00:01:05.600
70
+ and the network extracts some features
71
+
72
+ 00:01:02.640 --> 00:01:08.640
73
+ that makes a dog a dog right so that is
74
+
75
+ 00:01:05.600 --> 00:01:11.760
76
+ known as feature extraction and based on
77
+
78
+ 00:01:08.640 --> 00:01:13.760
79
+ that when you submit a new image of dog
80
+
81
+ 00:01:11.760 --> 00:01:15.119
82
+ the basic features remain pretty much
83
+
84
+ 00:01:13.760 --> 00:01:17.759
85
+ the same it may be a completely
86
+
87
+ 00:01:15.119 --> 00:01:21.280
88
+ different image but the features of a
89
+
90
+ 00:01:17.759 --> 00:01:23.200
91
+ dog still remain pretty much the same in
92
+
93
+ 00:01:21.280 --> 00:01:25.680
94
+ various different images let's say
95
+
96
+ 00:01:23.200 --> 00:01:28.000
97
+ compared to a cat and that's the way
98
+
99
+ 00:01:25.680 --> 00:01:30.479
100
+ artificial neural network works we'll go
101
+
102
+ 00:01:28.000 --> 00:01:32.240
103
+ into details of this uh very shortly and
104
+
105
+ 00:01:30.479 --> 00:01:35.119
106
+ once the training is done with training
107
+
108
+ 00:01:32.240 --> 00:01:37.439
109
+ data we then test it with some test data
110
+
111
+ 00:01:35.119 --> 00:01:39.840
112
+ too which is basically completely new
113
+
114
+ 00:01:37.439 --> 00:01:42.240
115
+ data which the system has not seen
116
+
117
+ 00:01:39.840 --> 00:01:43.920
118
+ before unlike the training data and then
119
+
120
+ 00:01:42.240 --> 00:01:46.560
121
+ we find out whether it is predicting
122
+
123
+ 00:01:43.920 --> 00:01:49.280
124
+ correctly or not thereby we know whether
125
+
126
+ 00:01:46.560 --> 00:01:50.799
127
+ the training is complete or it needs
128
+
129
+ 00:01:49.280 --> 00:01:53.119
130
+ more training so that's not a very high
131
+
132
+ 00:01:50.799 --> 00:01:55.040
133
+ level artificial neural network works so
134
+
135
+ 00:01:53.119 --> 00:01:57.119
136
+ this is what we are going to talk about
137
+
138
+ 00:01:55.040 --> 00:01:59.200
139
+ today our agenda looks something like
140
+
141
+ 00:01:57.119 --> 00:02:00.799
142
+ this what is deep learning why do we
143
+
144
+ 00:01:59.200 --> 00:02:03.040
145
+ need deep learning and then what are the
146
+
147
+ 00:02:00.799 --> 00:02:05.920
148
+ applications of deep learning one of the
149
+
150
+ 00:02:03.040 --> 00:02:08.239
151
+ main components the secret sauce in deep
152
+
153
+ 00:02:05.920 --> 00:02:09.599
154
+ learning is neural networks so we're
155
+
156
+ 00:02:08.239 --> 00:02:10.879
157
+ going to talk about what is neural
158
+
159
+ 00:02:09.599 --> 00:02:12.879
160
+ network and
161
+
162
+ 00:02:10.879 --> 00:02:15.520
163
+ how it works and some of its components
164
+
165
+ 00:02:12.879 --> 00:02:17.440
166
+ like for example the activation function
167
+
168
+ 00:02:15.520 --> 00:02:20.160
169
+ the gradient descent and so on and so
170
+
171
+ 00:02:17.440 --> 00:02:21.680
172
+ forth so that as a part of working of a
173
+
174
+ 00:02:20.160 --> 00:02:23.520
175
+ neural network we will go into little
176
+
177
+ 00:02:21.680 --> 00:02:26.720
178
+ bit more details how this whole thing
179
+
180
+ 00:02:23.520 --> 00:02:29.360
181
+ works so without much further ado let's
182
+
183
+ 00:02:26.720 --> 00:02:31.520
184
+ get started so deep learning is
185
+
186
+ 00:02:29.360 --> 00:02:34.080
187
+ considered to be a part of machine
188
+
189
+ 00:02:31.520 --> 00:02:36.720
190
+ learning so this diagram very nicely
191
+
192
+ 00:02:34.080 --> 00:02:39.599
193
+ depicts what deep learning is at a very
194
+
195
+ 00:02:36.720 --> 00:02:42.480
196
+ high level you have the all-encompassing
197
+
198
+ 00:02:39.599 --> 00:02:45.840
199
+ artificial intelligence which is more a
200
+
201
+ 00:02:42.480 --> 00:02:47.680
202
+ concept rather than a technology or a
203
+
204
+ 00:02:45.840 --> 00:02:49.280
205
+ technical concept right so it is it's
206
+
207
+ 00:02:47.680 --> 00:02:51.440
208
+ more of a concept at a very high level
209
+
210
+ 00:02:49.280 --> 00:02:53.200
211
+ artificial intelligence under the herd
212
+
213
+ 00:02:51.440 --> 00:02:55.360
214
+ is actually machine learning and deep
215
+
216
+ 00:02:53.200 --> 00:02:58.560
217
+ learning and machine learning is a
218
+
219
+ 00:02:55.360 --> 00:03:01.840
220
+ broader concept you can say or a broader
221
+
222
+ 00:02:58.560 --> 00:03:03.280
223
+ technology and deep learning is a subset
224
+
225
+ 00:03:01.840 --> 00:03:05.440
226
+ of machine learning the primary
227
+
228
+ 00:03:03.280 --> 00:03:07.920
229
+ difference between machine learning and
230
+
231
+ 00:03:05.440 --> 00:03:11.519
232
+ deep learning is that deep learning uses
233
+
234
+ 00:03:07.920 --> 00:03:14.080
235
+ neural networks and it is suitable for
236
+
237
+ 00:03:11.519 --> 00:03:16.480
238
+ handling large amounts of unstructured
239
+
240
+ 00:03:14.080 --> 00:03:18.080
241
+ data and the last but not least one of
242
+
243
+ 00:03:16.480 --> 00:03:19.599
244
+ the major differences between machine
245
+
246
+ 00:03:18.080 --> 00:03:22.080
247
+ learning and deep learning is that in
248
+
249
+ 00:03:19.599 --> 00:03:24.640
250
+ machine learning the feature extraction
251
+
252
+ 00:03:22.080 --> 00:03:26.959
253
+ or the feature engineering is done by
254
+
255
+ 00:03:24.640 --> 00:03:29.280
256
+ the data scientists manually but in deep
257
+
258
+ 00:03:26.959 --> 00:03:30.799
259
+ learning since we use neural networks
260
+
261
+ 00:03:29.280 --> 00:03:32.720
262
+ the feature engineering happens
263
+
264
+ 00:03:30.799 --> 00:03:34.720
265
+ automatically so that's a little bit of
266
+
267
+ 00:03:32.720 --> 00:03:36.000
268
+ a quick difference between machine
269
+
270
+ 00:03:34.720 --> 00:03:38.159
271
+ learning and deep learning and this
272
+
273
+ 00:03:36.000 --> 00:03:40.000
274
+ diagram very nicely depicts the relation
275
+
276
+ 00:03:38.159 --> 00:03:42.239
277
+ between artificial intelligence machine
278
+
279
+ 00:03:40.000 --> 00:03:44.319
280
+ learning and deep learning now why do we
281
+
282
+ 00:03:42.239 --> 00:03:47.040
283
+ need deep learning machine learning was
284
+
285
+ 00:03:44.319 --> 00:03:49.120
286
+ there for quite some time and it can do
287
+
288
+ 00:03:47.040 --> 00:03:51.599
289
+ a lot of stuff that probably what deep
290
+
291
+ 00:03:49.120 --> 00:03:53.680
292
+ learning can do but it's not very good
293
+
294
+ 00:03:51.599 --> 00:03:57.200
295
+ at handling large amounts of
296
+
297
+ 00:03:53.680 --> 00:03:59.920
298
+ unstructured data like images voice or
299
+
300
+ 00:03:57.200 --> 00:04:01.920
301
+ even text for that matter so traditional
302
+
303
+ 00:03:59.920 --> 00:04:03.519
304
+ machine learning is not that very good
305
+
306
+ 00:04:01.920 --> 00:04:05.040
307
+ at doing this traditional machine
308
+
309
+ 00:04:03.519 --> 00:04:07.040
310
+ learning can handle large amounts of
311
+
312
+ 00:04:05.040 --> 00:04:09.120
313
+ structured data but when it comes to
314
+
315
+ 00:04:07.040 --> 00:04:10.480
316
+ unstructured data it's a big challenge
317
+
318
+ 00:04:09.120 --> 00:04:12.560
319
+ so that is one of the key
320
+
321
+ 00:04:10.480 --> 00:04:15.519
322
+ differentiators for deep learning so
323
+
324
+ 00:04:12.560 --> 00:04:18.320
325
+ that is number one and increasingly for
326
+
327
+ 00:04:15.519 --> 00:04:20.400
328
+ artificial intelligence we need image
329
+
330
+ 00:04:18.320 --> 00:04:22.320
331
+ recognition and we need to process
332
+
333
+ 00:04:20.400 --> 00:04:23.680
334
+ analyze images and voice that's the
335
+
336
+ 00:04:22.320 --> 00:04:25.520
337
+ reason deep learning is required
338
+
339
+ 00:04:23.680 --> 00:04:27.840
340
+ compared to let's say traditional
341
+
342
+ 00:04:25.520 --> 00:04:31.199
343
+ machine learning it can also perform
344
+
345
+ 00:04:27.840 --> 00:04:33.120
346
+ complex algorithms more complex than
347
+
348
+ 00:04:31.199 --> 00:04:35.919
349
+ let's say what machine learning can do
350
+
351
+ 00:04:33.120 --> 00:04:38.000
352
+ and it can achieve best performance with
353
+
354
+ 00:04:35.919 --> 00:04:39.919
355
+ the large amounts of data so the more
356
+
357
+ 00:04:38.000 --> 00:04:42.800
358
+ you have the data let's say reference
359
+
360
+ 00:04:39.919 --> 00:04:44.639
361
+ data or label data the better the system
362
+
363
+ 00:04:42.800 --> 00:04:46.960
364
+ will do because the training process
365
+
366
+ 00:04:44.639 --> 00:04:49.040
367
+ will be that much better and last but
368
+
369
+ 00:04:46.960 --> 00:04:51.600
370
+ not least with deep learning you can
371
+
372
+ 00:04:49.040 --> 00:04:53.360
373
+ really avoid the manual process of
374
+
375
+ 00:04:51.600 --> 00:04:55.280
376
+ feature extraction those are some of the
377
+
378
+ 00:04:53.360 --> 00:04:57.120
379
+ reasons why we need deep learning some
380
+
381
+ 00:04:55.280 --> 00:05:00.160
382
+ of the applications of deep learning
383
+
384
+ 00:04:57.120 --> 00:05:02.960
385
+ deep learning has made major inroads and
386
+
387
+ 00:05:00.160 --> 00:05:05.440
388
+ it is a major area in which deep
389
+
390
+ 00:05:02.960 --> 00:05:08.880
391
+ learning is applied is healthcare and
392
+
393
+ 00:05:05.440 --> 00:05:12.080
394
+ within healthcare particularly oncology
395
+
396
+ 00:05:08.880 --> 00:05:15.199
397
+ which is basically cancer related stuff
398
+
399
+ 00:05:12.080 --> 00:05:17.919
400
+ one of the issues with cancer is that a
401
+
402
+ 00:05:15.199 --> 00:05:20.960
403
+ lot of cancers today are curable they
404
+
405
+ 00:05:17.919 --> 00:05:23.360
406
+ can be cured they are detected early on
407
+
408
+ 00:05:20.960 --> 00:05:25.600
409
+ and the challenge with that is when a
410
+
411
+ 00:05:23.360 --> 00:05:28.080
412
+ diagnostics is performed let's say an
413
+
414
+ 00:05:25.600 --> 00:05:30.320
415
+ image has been taken of a patient to
416
+
417
+ 00:05:28.080 --> 00:05:33.120
418
+ detect whether there is cancer or not
419
+
420
+ 00:05:30.320 --> 00:05:35.120
421
+ you need a specialist to look at the
422
+
423
+ 00:05:33.120 --> 00:05:38.080
424
+ image and determine whether it is the
425
+
426
+ 00:05:35.120 --> 00:05:41.199
427
+ patient is fine or there is any onset of
428
+
429
+ 00:05:38.080 --> 00:05:44.160
430
+ cancer and the number of specialists are
431
+
432
+ 00:05:41.199 --> 00:05:46.639
433
+ limited so if we use deep learning if we
434
+
435
+ 00:05:44.160 --> 00:05:48.880
436
+ use automation here or if we use
437
+
438
+ 00:05:46.639 --> 00:05:52.000
439
+ artificial intelligence here then the
440
+
441
+ 00:05:48.880 --> 00:05:54.639
442
+ system can with a certain amount of the
443
+
444
+ 00:05:52.000 --> 00:05:57.520
445
+ good amount of accuracy determine
446
+
447
+ 00:05:54.639 --> 00:06:00.000
448
+ whether a particular patient is having
449
+
450
+ 00:05:57.520 --> 00:06:02.960
451
+ cancer or not so the prediction or the
452
+
453
+ 00:06:00.000 --> 00:06:05.919
454
+ detection process of a disease like
455
+
456
+ 00:06:02.960 --> 00:06:08.160
457
+ cancer can be expedited the detection
458
+
459
+ 00:06:05.919 --> 00:06:10.800
460
+ process can be expedited can be faster
461
+
462
+ 00:06:08.160 --> 00:06:13.600
463
+ without really waiting for a specialist
464
+
465
+ 00:06:10.800 --> 00:06:15.919
466
+ we can obviously then once the
467
+
468
+ 00:06:13.600 --> 00:06:18.479
469
+ application once the artificial
470
+
471
+ 00:06:15.919 --> 00:06:20.800
472
+ intelligence detects or predicts that
473
+
474
+ 00:06:18.479 --> 00:06:23.120
475
+ there is an onset of a cancer this can
476
+
477
+ 00:06:20.800 --> 00:06:25.680
478
+ be cross-checked by a doctor but at
479
+
480
+ 00:06:23.120 --> 00:06:27.520
481
+ least the initial screening process can
482
+
483
+ 00:06:25.680 --> 00:06:29.919
484
+ be automated and that is where the
485
+
486
+ 00:06:27.520 --> 00:06:32.160
487
+ current focus is with respect to deep
488
+
489
+ 00:06:29.919 --> 00:06:34.560
490
+ learning in healthcare what else
491
+
492
+ 00:06:32.160 --> 00:06:38.319
493
+ robotics is another area deep learning
494
+
495
+ 00:06:34.560 --> 00:06:40.880
496
+ is majorly used in robotics and you must
497
+
498
+ 00:06:38.319 --> 00:06:43.199
499
+ have seen nowadays robots are everywhere
500
+
501
+ 00:06:40.880 --> 00:06:45.120
502
+ humanoids the industrial robots which
503
+
504
+ 00:06:43.199 --> 00:06:48.080
505
+ are used for manufacturing process you
506
+
507
+ 00:06:45.120 --> 00:06:50.639
508
+ must have heard about sofia who got
509
+
510
+ 00:06:48.080 --> 00:06:53.360
511
+ citizenship with saudi arabia and so on
512
+
513
+ 00:06:50.639 --> 00:06:55.840
514
+ there are multiple such robots which are
515
+
516
+ 00:06:53.360 --> 00:06:58.880
517
+ knowledge oriented but there are also
518
+
519
+ 00:06:55.840 --> 00:07:00.639
520
+ industrial robots are used in industries
521
+
522
+ 00:06:58.880 --> 00:07:03.120
523
+ in the manufacturing process and
524
+
525
+ 00:07:00.639 --> 00:07:05.440
526
+ increasingly in security and also in
527
+
528
+ 00:07:03.120 --> 00:07:07.840
529
+ defense for example image processing
530
+
531
+ 00:07:05.440 --> 00:07:10.080
532
+ video is fed to them and they need to be
533
+
534
+ 00:07:07.840 --> 00:07:11.599
535
+ able to detect objects obstacles and so
536
+
537
+ 00:07:10.080 --> 00:07:13.520
538
+ on and so forth so that's where deep
539
+
540
+ 00:07:11.599 --> 00:07:15.599
541
+ learning is used they need to be able to
542
+
543
+ 00:07:13.520 --> 00:07:17.520
544
+ hear and make sense of the sounds that
545
+
546
+ 00:07:15.599 --> 00:07:20.400
547
+ they are hearing that needs deep
548
+
549
+ 00:07:17.520 --> 00:07:22.800
550
+ learning as well so robotics is a major
551
+
552
+ 00:07:20.400 --> 00:07:25.680
553
+ area where deep learning is applied then
554
+
555
+ 00:07:22.800 --> 00:07:27.919
556
+ we have self-driving cars or autonomous
557
+
558
+ 00:07:25.680 --> 00:07:30.960
559
+ cars you must have heard of google's
560
+
561
+ 00:07:27.919 --> 00:07:33.759
562
+ autonomous car which has been tested for
563
+
564
+ 00:07:30.960 --> 00:07:35.440
565
+ millions of miles and pretty much
566
+
567
+ 00:07:33.759 --> 00:07:37.120
568
+ incident free there were of course a
569
+
570
+ 00:07:35.440 --> 00:07:39.759
571
+ couple of incidents here and there but
572
+
573
+ 00:07:37.120 --> 00:07:42.880
574
+ it is uh considered to be fairly safe
575
+
576
+ 00:07:39.759 --> 00:07:45.120
577
+ and there are today a lot of automotive
578
+
579
+ 00:07:42.880 --> 00:07:47.520
580
+ companies in fact pretty much every
581
+
582
+ 00:07:45.120 --> 00:07:49.919
583
+ automotive company worth its name is
584
+
585
+ 00:07:47.520 --> 00:07:52.080
586
+ investing in self-driving cars or
587
+
588
+ 00:07:49.919 --> 00:07:54.560
589
+ autonomous cars and it is predicted that
590
+
591
+ 00:07:52.080 --> 00:07:56.160
592
+ in the next probably 10 to 15 years
593
+
594
+ 00:07:54.560 --> 00:07:59.120
595
+ these will be in production and they
596
+
597
+ 00:07:56.160 --> 00:08:01.039
598
+ will be used extensively in real life
599
+
600
+ 00:07:59.120 --> 00:08:03.039
601
+ right now they are all in rnd and in
602
+
603
+ 00:08:01.039 --> 00:08:05.360
604
+ test phases but pretty soon these will
605
+
606
+ 00:08:03.039 --> 00:08:07.280
607
+ be on the road so this is another area
608
+
609
+ 00:08:05.360 --> 00:08:08.960
610
+ where deep learning is used and how is
611
+
612
+ 00:08:07.280 --> 00:08:11.759
613
+ it used where is it used within
614
+
615
+ 00:08:08.960 --> 00:08:14.960
616
+ autonomous driving the car actually is
617
+
618
+ 00:08:11.759 --> 00:08:17.039
619
+ fed with video of surroundings and it is
620
+
621
+ 00:08:14.960 --> 00:08:18.879
622
+ supposed to process that information
623
+
624
+ 00:08:17.039 --> 00:08:20.800
625
+ process that video and determine if
626
+
627
+ 00:08:18.879 --> 00:08:23.039
628
+ there are any obstacles it has to
629
+
630
+ 00:08:20.800 --> 00:08:25.759
631
+ determine if there are any cars in the
632
+
633
+ 00:08:23.039 --> 00:08:28.160
634
+ site will detect whether it is driving
635
+
636
+ 00:08:25.759 --> 00:08:31.759
637
+ in the lane also it has to determine
638
+
639
+ 00:08:28.160 --> 00:08:34.159
640
+ whether the signal is green or red so
641
+
642
+ 00:08:31.759 --> 00:08:37.760
643
+ that accordingly it can move forward or
644
+
645
+ 00:08:34.159 --> 00:08:39.599
646
+ wait so for all these video analysis
647
+
648
+ 00:08:37.760 --> 00:08:41.919
649
+ deep learning is used in addition to
650
+
651
+ 00:08:39.599 --> 00:08:44.720
652
+ that the training overall training to
653
+
654
+ 00:08:41.919 --> 00:08:47.200
655
+ drive the car happens in a deep learning
656
+
657
+ 00:08:44.720 --> 00:08:48.720
658
+ environment so again a lot of scope here
659
+
660
+ 00:08:47.200 --> 00:08:51.120
661
+ to use deep learning a couple of other
662
+
663
+ 00:08:48.720 --> 00:08:54.880
664
+ applications are mission translations
665
+
666
+ 00:08:51.120 --> 00:08:57.760
667
+ today we have a lot of information and
668
+
669
+ 00:08:54.880 --> 00:08:59.519
670
+ very often this information is in one
671
+
672
+ 00:08:57.760 --> 00:09:03.120
673
+ particular language and more
674
+
675
+ 00:08:59.519 --> 00:09:05.519
676
+ specifically in english and people need
677
+
678
+ 00:09:03.120 --> 00:09:08.560
679
+ information in various parts of the
680
+
681
+ 00:09:05.519 --> 00:09:11.120
682
+ world it is pretty difficult for human
683
+
684
+ 00:09:08.560 --> 00:09:13.519
685
+ beings to translate each and every piece
686
+
687
+ 00:09:11.120 --> 00:09:15.279
688
+ of information or every document into
689
+
690
+ 00:09:13.519 --> 00:09:17.440
691
+ all possible languages there are
692
+
693
+ 00:09:15.279 --> 00:09:19.600
694
+ probably at least hundreds of languages
695
+
696
+ 00:09:17.440 --> 00:09:22.720
697
+ or if not more to translate each and
698
+
699
+ 00:09:19.600 --> 00:09:25.920
700
+ every document into every language is
701
+
702
+ 00:09:22.720 --> 00:09:28.560
703
+ pretty difficult therefore we can use
704
+
705
+ 00:09:25.920 --> 00:09:31.440
706
+ deep learning to do pretty much like a
707
+
708
+ 00:09:28.560 --> 00:09:33.200
709
+ real-time translation mechanism so we
710
+
711
+ 00:09:31.440 --> 00:09:36.160
712
+ don't have to translate everything and
713
+
714
+ 00:09:33.200 --> 00:09:38.640
715
+ keep it ready but we train applications
716
+
717
+ 00:09:36.160 --> 00:09:41.519
718
+ or artificial intelligence systems that
719
+
720
+ 00:09:38.640 --> 00:09:44.560
721
+ will do the translation on the fly for
722
+
723
+ 00:09:41.519 --> 00:09:46.320
724
+ example you go to somewhere like china
725
+
726
+ 00:09:44.560 --> 00:09:48.480
727
+ and you want to know what is written on
728
+
729
+ 00:09:46.320 --> 00:09:50.800
730
+ a signboard now it is impossible for
731
+
732
+ 00:09:48.480 --> 00:09:52.800
733
+ somebody to translate that and put it on
734
+
735
+ 00:09:50.800 --> 00:09:55.440
736
+ the web or something like that so you
737
+
738
+ 00:09:52.800 --> 00:09:57.920
739
+ have an application which is trained to
740
+
741
+ 00:09:55.440 --> 00:10:00.000
742
+ translate stuff on the fly so you
743
+
744
+ 00:09:57.920 --> 00:10:02.240
745
+ probably this can be running on your
746
+
747
+ 00:10:00.000 --> 00:10:05.200
748
+ mobile phone on your smartphone you scan
749
+
750
+ 00:10:02.240 --> 00:10:07.440
751
+ this the application will instantly
752
+
753
+ 00:10:05.200 --> 00:10:10.240
754
+ translate that from chinese to english
755
+
756
+ 00:10:07.440 --> 00:10:11.760
757
+ that is one then there could be web
758
+
759
+ 00:10:10.240 --> 00:10:14.399
760
+ applications where there may be a
761
+
762
+ 00:10:11.760 --> 00:10:16.640
763
+ research document which is all in maybe
764
+
765
+ 00:10:14.399 --> 00:10:19.839
766
+ chinese or japanese and you want to
767
+
768
+ 00:10:16.640 --> 00:10:22.000
769
+ translate that to study that document or
770
+
771
+ 00:10:19.839 --> 00:10:23.839
772
+ in that case you need to translate so
773
+
774
+ 00:10:22.000 --> 00:10:26.160
775
+ therefore deep learning is used in such
776
+
777
+ 00:10:23.839 --> 00:10:28.160
778
+ situations as well and that is again on
779
+
780
+ 00:10:26.160 --> 00:10:30.240
781
+ demand so it is not like you have to
782
+
783
+ 00:10:28.160 --> 00:10:31.920
784
+ translate all these documents from other
785
+
786
+ 00:10:30.240 --> 00:10:34.000
787
+ languages into english and one shot and
788
+
789
+ 00:10:31.920 --> 00:10:36.480
790
+ keep it somewhere that is again pretty
791
+
792
+ 00:10:34.000 --> 00:10:38.160
793
+ much an impossible task but on a neat
794
+
795
+ 00:10:36.480 --> 00:10:40.399
796
+ basis so you have systems that are
797
+
798
+ 00:10:38.160 --> 00:10:42.000
799
+ trained to translate on the fly so
800
+
801
+ 00:10:40.399 --> 00:10:43.600
802
+ mission translation is another major
803
+
804
+ 00:10:42.000 --> 00:10:45.920
805
+ area where deep learning is used then
806
+
807
+ 00:10:43.600 --> 00:10:48.800
808
+ there are a few other upcoming areas
809
+
810
+ 00:10:45.920 --> 00:10:51.279
811
+ where synthesizing is done by neural
812
+
813
+ 00:10:48.800 --> 00:10:53.680
814
+ nets for example music composition and
815
+
816
+ 00:10:51.279 --> 00:10:56.880
817
+ generation of music so you can train a
818
+
819
+ 00:10:53.680 --> 00:10:59.680
820
+ neural net to produce music even to
821
+
822
+ 00:10:56.880 --> 00:11:02.000
823
+ compose music so this is a fun thing
824
+
825
+ 00:10:59.680 --> 00:11:04.720
826
+ this is still upcoming it needs a lot of
827
+
828
+ 00:11:02.000 --> 00:11:06.640
829
+ effort to train such neural net it has
830
+
831
+ 00:11:04.720 --> 00:11:09.120
832
+ been proved that it is possible so this
833
+
834
+ 00:11:06.640 --> 00:11:11.760
835
+ is a relatively new area and on the same
836
+
837
+ 00:11:09.120 --> 00:11:13.920
838
+ lines colorization of images so these
839
+
840
+ 00:11:11.760 --> 00:11:15.839
841
+ two images on the left hand side is a
842
+
843
+ 00:11:13.920 --> 00:11:18.720
844
+ grayscale image or a black and white
845
+
846
+ 00:11:15.839 --> 00:11:20.480
847
+ image this was colored by a neural net
848
+
849
+ 00:11:18.720 --> 00:11:22.959
850
+ or a deep learning application as you
851
+
852
+ 00:11:20.480 --> 00:11:25.040
853
+ can see it's done a very good job of
854
+
855
+ 00:11:22.959 --> 00:11:28.000
856
+ applying the colors and obviously this
857
+
858
+ 00:11:25.040 --> 00:11:30.320
859
+ was trained to do this colorization but
860
+
861
+ 00:11:28.000 --> 00:11:33.360
862
+ yes this is one more application of deep
863
+
864
+ 00:11:30.320 --> 00:11:37.279
865
+ learning now one of the major secret
866
+
867
+ 00:11:33.360 --> 00:11:40.160
868
+ sauce of deep learning is neural network
869
+
870
+ 00:11:37.279 --> 00:11:42.240
871
+ deep learning works on neural network or
872
+
873
+ 00:11:40.160 --> 00:11:45.279
874
+ consists of neural network so let us see
875
+
876
+ 00:11:42.240 --> 00:11:49.040
877
+ what is neural network neural network or
878
+
879
+ 00:11:45.279 --> 00:11:53.360
880
+ artificial neural network is designed or
881
+
882
+ 00:11:49.040 --> 00:11:56.880
883
+ based on the human brain now human brain
884
+
885
+ 00:11:53.360 --> 00:11:59.519
886
+ consists of billions of small cells that
887
+
888
+ 00:11:56.880 --> 00:12:03.120
889
+ are known as neurons artificial neural
890
+
891
+ 00:11:59.519 --> 00:12:05.519
892
+ networks is in a way trying to simulate
893
+
894
+ 00:12:03.120 --> 00:12:07.839
895
+ the human brain so this is a quick
896
+
897
+ 00:12:05.519 --> 00:12:10.399
898
+ diagram of biological neuron a
899
+
900
+ 00:12:07.839 --> 00:12:12.959
901
+ biological neuron consists of the major
902
+
903
+ 00:12:10.399 --> 00:12:16.079
904
+ part which is the cell nucleus and then
905
+
906
+ 00:12:12.959 --> 00:12:18.240
907
+ it has some tentacles kind of stuff on
908
+
909
+ 00:12:16.079 --> 00:12:20.160
910
+ the top called dendrite and then there
911
+
912
+ 00:12:18.240 --> 00:12:22.399
913
+ is like a long tail which is known as
914
+
915
+ 00:12:20.160 --> 00:12:24.240
916
+ the axon further again at the end of
917
+
918
+ 00:12:22.399 --> 00:12:27.680
919
+ this action are what are known as
920
+
921
+ 00:12:24.240 --> 00:12:30.880
922
+ synapses these in turn are connected to
923
+
924
+ 00:12:27.680 --> 00:12:33.680
925
+ the dendrites of the next neuron and all
926
+
927
+ 00:12:30.880 --> 00:12:35.440
928
+ these neurons are interconnected with
929
+
930
+ 00:12:33.680 --> 00:12:37.519
931
+ each other therefore they are like
932
+
933
+ 00:12:35.440 --> 00:12:39.440
934
+ billions of them sitting in our brain
935
+
936
+ 00:12:37.519 --> 00:12:42.000
937
+ and they're all active they're working
938
+
939
+ 00:12:39.440 --> 00:12:45.360
940
+ they based on the signals they receive
941
+
942
+ 00:12:42.000 --> 00:12:47.920
943
+ signals as inputs from other neurons or
944
+
945
+ 00:12:45.360 --> 00:12:50.639
946
+ maybe from other parts of the body and
947
+
948
+ 00:12:47.920 --> 00:12:52.720
949
+ based on certain criteria they send
950
+
951
+ 00:12:50.639 --> 00:12:54.800
952
+ signals to the neurons at the other end
953
+
954
+ 00:12:52.720 --> 00:12:56.880
955
+ so they they get either activated or
956
+
957
+ 00:12:54.800 --> 00:12:59.760
958
+ they don't get activated based on so it
959
+
960
+ 00:12:56.880 --> 00:13:02.480
961
+ is like a binary gates so they get
962
+
963
+ 00:12:59.760 --> 00:13:04.800
964
+ activated or not activated based on the
965
+
966
+ 00:13:02.480 --> 00:13:06.399
967
+ inputs that they receive and so on so we
968
+
969
+ 00:13:04.800 --> 00:13:08.720
970
+ will see a little bit of those details
971
+
972
+ 00:13:06.399 --> 00:13:10.880
973
+ as we move forward in our artificial
974
+
975
+ 00:13:08.720 --> 00:13:12.320
976
+ neuron but this is a biological neuron
977
+
978
+ 00:13:10.880 --> 00:13:15.200
979
+ this is the structure of a biological
980
+
981
+ 00:13:12.320 --> 00:13:17.680
982
+ neuron and artificial neural network is
983
+
984
+ 00:13:15.200 --> 00:13:20.320
985
+ based on the human brain the smallest
986
+
987
+ 00:13:17.680 --> 00:13:23.440
988
+ component of artificial neural network
989
+
990
+ 00:13:20.320 --> 00:13:25.839
991
+ is an artificial neuron as shown here
992
+
993
+ 00:13:23.440 --> 00:13:28.000
994
+ sometimes is also referred to as
995
+
996
+ 00:13:25.839 --> 00:13:30.240
997
+ perceptron now this is a very high level
998
+
999
+ 00:13:28.000 --> 00:13:32.800
1000
+ diagram the artificial neuron has a
1001
+
1002
+ 00:13:30.240 --> 00:13:35.760
1003
+ small central unit which will receive
1004
+
1005
+ 00:13:32.800 --> 00:13:38.320
1006
+ the input if it is doing let's say image
1007
+
1008
+ 00:13:35.760 --> 00:13:41.040
1009
+ processing the inputs could be pixel
1010
+
1011
+ 00:13:38.320 --> 00:13:44.480
1012
+ values of the image which is represented
1013
+
1014
+ 00:13:41.040 --> 00:13:47.680
1015
+ here as x1 x2 and so on each of the
1016
+
1017
+ 00:13:44.480 --> 00:13:50.320
1018
+ inputs are multiplied by what is known
1019
+
1020
+ 00:13:47.680 --> 00:13:53.200
1021
+ as weights which are represented as w1
1022
+
1023
+ 00:13:50.320 --> 00:13:56.240
1024
+ w2 and so on there is in the central
1025
+
1026
+ 00:13:53.200 --> 00:13:59.600
1027
+ unit basically there is a summation of
1028
+
1029
+ 00:13:56.240 --> 00:14:03.279
1030
+ these weighted inputs which is like x1
1031
+
1032
+ 00:13:59.600 --> 00:14:06.160
1033
+ into w1 plus x2 into w2 and so on the
1034
+
1035
+ 00:14:03.279 --> 00:14:08.079
1036
+ products are then added and then there
1037
+
1038
+ 00:14:06.160 --> 00:14:10.720
1039
+ is a bias that is added to that in the
1040
+
1041
+ 00:14:08.079 --> 00:14:12.959
1042
+ next slide we will see that passes
1043
+
1044
+ 00:14:10.720 --> 00:14:16.160
1045
+ through an activation function and the
1046
+
1047
+ 00:14:12.959 --> 00:14:18.720
1048
+ output comes as a y which is the output
1049
+
1050
+ 00:14:16.160 --> 00:14:20.880
1051
+ and based on certain criteria the cell
1052
+
1053
+ 00:14:18.720 --> 00:14:23.519
1054
+ gets either activated or not activated
1055
+
1056
+ 00:14:20.880 --> 00:14:26.959
1057
+ so this output would be like a zero or a
1058
+
1059
+ 00:14:23.519 --> 00:14:28.639
1060
+ one binary format okay so we will see
1061
+
1062
+ 00:14:26.959 --> 00:14:30.639
1063
+ that in a little bit more detail but
1064
+
1065
+ 00:14:28.639 --> 00:14:33.040
1066
+ let's do a quick comparison between
1067
+
1068
+ 00:14:30.639 --> 00:14:35.040
1069
+ biological and artificial neurons just
1070
+
1071
+ 00:14:33.040 --> 00:14:36.639
1072
+ like a biological neuron there are
1073
+
1074
+ 00:14:35.040 --> 00:14:39.600
1075
+ dendrites and then there is a cell
1076
+
1077
+ 00:14:36.639 --> 00:14:42.880
1078
+ nucleus and synapse and an axon
1079
+
1080
+ 00:14:39.600 --> 00:14:45.920
1081
+ we have in the artificial neuron as well
1082
+
1083
+ 00:14:42.880 --> 00:14:48.160
1084
+ these inputs come like the dead right if
1085
+
1086
+ 00:14:45.920 --> 00:14:50.320
1087
+ you will act like the dendrites there is
1088
+
1089
+ 00:14:48.160 --> 00:14:52.880
1090
+ a like a central unit which performs the
1091
+
1092
+ 00:14:50.320 --> 00:14:56.160
1093
+ summation of these uh weighted inputs
1094
+
1095
+ 00:14:52.880 --> 00:14:58.880
1096
+ which is basically w1 x1 w2 x2 and so on
1097
+
1098
+ 00:14:56.160 --> 00:15:00.639
1099
+ and then our bias is added here and then
1100
+
1101
+ 00:14:58.880 --> 00:15:02.880
1102
+ that passes through what is known as an
1103
+
1104
+ 00:15:00.639 --> 00:15:04.639
1105
+ activation function okay so these are
1106
+
1107
+ 00:15:02.880 --> 00:15:06.880
1108
+ known as the weights w1 w2 and then
1109
+
1110
+ 00:15:04.639 --> 00:15:09.519
1111
+ there is a bias which will come out here
1112
+
1113
+ 00:15:06.880 --> 00:15:11.600
1114
+ and that is added the bias is by the way
1115
+
1116
+ 00:15:09.519 --> 00:15:14.320
1117
+ common for a particular neuron so there
1118
+
1119
+ 00:15:11.600 --> 00:15:16.800
1120
+ won't be like b1 b2 b3 and so on only
1121
+
1122
+ 00:15:14.320 --> 00:15:19.440
1123
+ weights will be one per input the bias
1124
+
1125
+ 00:15:16.800 --> 00:15:22.639
1126
+ is common for the entire neuron it is
1127
+
1128
+ 00:15:19.440 --> 00:15:25.360
1129
+ also common for or the value of the bias
1130
+
1131
+ 00:15:22.639 --> 00:15:28.000
1132
+ remains the same for all the neurons in
1133
+
1134
+ 00:15:25.360 --> 00:15:29.920
1135
+ a particular layer we will also see this
1136
+
1137
+ 00:15:28.000 --> 00:15:31.600
1138
+ as we move forward and we see deep
1139
+
1140
+ 00:15:29.920 --> 00:15:34.160
1141
+ neural network where there are multiple
1142
+
1143
+ 00:15:31.600 --> 00:15:37.920
1144
+ neurons so that's the output now the
1145
+
1146
+ 00:15:34.160 --> 00:15:41.519
1147
+ whole exercise of training the neuron is
1148
+
1149
+ 00:15:37.920 --> 00:15:43.519
1150
+ about changing these weights and biases
1151
+
1152
+ 00:15:41.519 --> 00:15:46.000
1153
+ as i mentioned artificial neural network
1154
+
1155
+ 00:15:43.519 --> 00:15:48.560
1156
+ will consist of several such neurons and
1157
+
1158
+ 00:15:46.000 --> 00:15:50.880
1159
+ as a part of the training process these
1160
+
1161
+ 00:15:48.560 --> 00:15:53.120
1162
+ weights keep changing initially they are
1163
+
1164
+ 00:15:50.880 --> 00:15:55.360
1165
+ assigned some random values through the
1166
+
1167
+ 00:15:53.120 --> 00:15:57.279
1168
+ training process the weights the whole
1169
+
1170
+ 00:15:55.360 --> 00:16:00.880
1171
+ process of training is to come up with
1172
+
1173
+ 00:15:57.279 --> 00:16:02.959
1174
+ the optimum values of w1 w2 and wn and
1175
+
1176
+ 00:16:00.880 --> 00:16:05.519
1177
+ then the b4 or the bias for this
1178
+
1179
+ 00:16:02.959 --> 00:16:08.399
1180
+ particular neuron such that it gives an
1181
+
1182
+ 00:16:05.519 --> 00:16:11.040
1183
+ accurate output as required so let's see
1184
+
1185
+ 00:16:08.399 --> 00:16:13.440
1186
+ what exactly that means so the training
1187
+
1188
+ 00:16:11.040 --> 00:16:16.720
1189
+ process this is how it happens it takes
1190
+
1191
+ 00:16:13.440 --> 00:16:19.040
1192
+ the inputs each input is multiplied by a
1193
+
1194
+ 00:16:16.720 --> 00:16:20.639
1195
+ weight and these weights during training
1196
+
1197
+ 00:16:19.040 --> 00:16:23.440
1198
+ keep changing so initially they are
1199
+
1200
+ 00:16:20.639 --> 00:16:25.519
1201
+ assigned some random values and based on
1202
+
1203
+ 00:16:23.440 --> 00:16:27.519
1204
+ the output whether it is correct or
1205
+
1206
+ 00:16:25.519 --> 00:16:29.759
1207
+ wrong there is a feedback coming back
1208
+
1209
+ 00:16:27.519 --> 00:16:33.120
1210
+ and that will basically change these
1211
+
1212
+ 00:16:29.759 --> 00:16:36.320
1213
+ weights until it starts giving the right
1214
+
1215
+ 00:16:33.120 --> 00:16:39.199
1216
+ output that is represented in here as
1217
+
1218
+ 00:16:36.320 --> 00:16:42.320
1219
+ sigma i going from 1 to n if there are n
1220
+
1221
+ 00:16:39.199 --> 00:16:46.160
1222
+ inputs wi into x i so this is the
1223
+
1224
+ 00:16:42.320 --> 00:16:49.920
1225
+ product of w1 x1 w2 x2 and so on right
1226
+
1227
+ 00:16:46.160 --> 00:16:52.959
1228
+ and there is a bias that gets added here
1229
+
1230
+ 00:16:49.920 --> 00:16:55.360
1231
+ and that entire thing goes to what is
1232
+
1233
+ 00:16:52.959 --> 00:16:59.120
1234
+ known as an activation function so
1235
+
1236
+ 00:16:55.360 --> 00:17:02.160
1237
+ essentially this is sigma of w i x i
1238
+
1239
+ 00:16:59.120 --> 00:17:05.360
1240
+ plus a value of bias which is a b so
1241
+
1242
+ 00:17:02.160 --> 00:17:07.919
1243
+ that entire thing goes as an input to an
1244
+
1245
+ 00:17:05.360 --> 00:17:10.480
1246
+ activation function now this activation
1247
+
1248
+ 00:17:07.919 --> 00:17:13.520
1249
+ function takes this as an input gives
1250
+
1251
+ 00:17:10.480 --> 00:17:15.439
1252
+ the output as a binary output it could
1253
+
1254
+ 00:17:13.520 --> 00:17:17.439
1255
+ be a zero or a one there are of course
1256
+
1257
+ 00:17:15.439 --> 00:17:18.959
1258
+ to start with let's assume it's a binary
1259
+
1260
+ 00:17:17.439 --> 00:17:20.799
1261
+ output later we will see that there are
1262
+
1263
+ 00:17:18.959 --> 00:17:23.120
1264
+ different types of activation functions
1265
+
1266
+ 00:17:20.799 --> 00:17:25.439
1267
+ so it need not always be binary output
1268
+
1269
+ 00:17:23.120 --> 00:17:28.160
1270
+ but to start with let's keep simple so
1271
+
1272
+ 00:17:25.439 --> 00:17:30.799
1273
+ it decides whether the neuron should be
1274
+
1275
+ 00:17:28.160 --> 00:17:33.280
1276
+ fired or not so that is the output like
1277
+
1278
+ 00:17:30.799 --> 00:17:35.280
1279
+ a binary output 0 or 1. all right so
1280
+
1281
+ 00:17:33.280 --> 00:17:36.960
1282
+ again let me summarize this so it takes
1283
+
1284
+ 00:17:35.280 --> 00:17:39.280
1285
+ the inputs so if you're processing an
1286
+
1287
+ 00:17:36.960 --> 00:17:42.559
1288
+ image for example the inputs are the
1289
+
1290
+ 00:17:39.280 --> 00:17:44.559
1291
+ pixel values of the image x1 x2 up to xn
1292
+
1293
+ 00:17:42.559 --> 00:17:46.480
1294
+ there could be hundreds of these so all
1295
+
1296
+ 00:17:44.559 --> 00:17:48.559
1297
+ of those are fed as so these are some
1298
+
1299
+ 00:17:46.480 --> 00:17:51.200
1300
+ values and these pixel values again can
1301
+
1302
+ 00:17:48.559 --> 00:17:54.400
1303
+ be from 0 to 56 each of those pixel
1304
+
1305
+ 00:17:51.200 --> 00:17:56.160
1306
+ values are then multiplied with what is
1307
+
1308
+ 00:17:54.400 --> 00:17:58.160
1309
+ known as a weight this is a numeric
1310
+
1311
+ 00:17:56.160 --> 00:18:01.360
1312
+ value can be any value so this is a
1313
+
1314
+ 00:17:58.160 --> 00:18:03.679
1315
+ number w1 similarly w2 is a number so
1316
+
1317
+ 00:18:01.360 --> 00:18:05.600
1318
+ initially some random values will be
1319
+
1320
+ 00:18:03.679 --> 00:18:07.520
1321
+ assigned and each of these weights are
1322
+
1323
+ 00:18:05.600 --> 00:18:09.919
1324
+ multiplied with the input value and
1325
+
1326
+ 00:18:07.520 --> 00:18:12.320
1327
+ their sum this is known as the weighted
1328
+
1329
+ 00:18:09.919 --> 00:18:14.960
1330
+ sum so that is performed in this kind of
1331
+
1332
+ 00:18:12.320 --> 00:18:17.440
1333
+ the central unit and then a bias is
1334
+
1335
+ 00:18:14.960 --> 00:18:20.080
1336
+ added remember the bias is common for
1337
+
1338
+ 00:18:17.440 --> 00:18:21.760
1339
+ each neuron so this is not the bias
1340
+
1341
+ 00:18:20.080 --> 00:18:24.559
1342
+ value is not one
1343
+
1344
+ 00:18:21.760 --> 00:18:26.640
1345
+ bias value for per input so just keep
1346
+
1347
+ 00:18:24.559 --> 00:18:28.640
1348
+ that in mind the bias value there is one
1349
+
1350
+ 00:18:26.640 --> 00:18:31.360
1351
+ bias per neuron so it is like this
1352
+
1353
+ 00:18:28.640 --> 00:18:33.200
1354
+ summation plus bias is the output from
1355
+
1356
+ 00:18:31.360 --> 00:18:34.880
1357
+ the section this is not the complete
1358
+
1359
+ 00:18:33.200 --> 00:18:37.600
1360
+ output of the neuron but this is the
1361
+
1362
+ 00:18:34.880 --> 00:18:39.200
1363
+ bias for output for step one that goes
1364
+
1365
+ 00:18:37.600 --> 00:18:41.520
1366
+ as an input to what is known as
1367
+
1368
+ 00:18:39.200 --> 00:18:44.320
1369
+ activation function and that activation
1370
+
1371
+ 00:18:41.520 --> 00:18:46.720
1372
+ function results in an output usually a
1373
+
1374
+ 00:18:44.320 --> 00:18:49.440
1375
+ binary output like a zero or a one which
1376
+
1377
+ 00:18:46.720 --> 00:18:51.919
1378
+ is known as the firing of the neuron
1379
+
1380
+ 00:18:49.440 --> 00:18:53.840
1381
+ okay good so we talked about activation
1382
+
1383
+ 00:18:51.919 --> 00:18:55.760
1384
+ function so what is an activation
1385
+
1386
+ 00:18:53.840 --> 00:18:58.880
1387
+ function an activation function
1388
+
1389
+ 00:18:55.760 --> 00:19:02.640
1390
+ basically takes the weighted sum which
1391
+
1392
+ 00:18:58.880 --> 00:19:05.520
1393
+ is we saw w1 x1 w2 x2 the sum of all
1394
+
1395
+ 00:19:02.640 --> 00:19:08.799
1396
+ that plus the bias so it takes that as
1397
+
1398
+ 00:19:05.520 --> 00:19:10.640
1399
+ an input and it generates a certain
1400
+
1401
+ 00:19:08.799 --> 00:19:12.640
1402
+ output now there are different types of
1403
+
1404
+ 00:19:10.640 --> 00:19:14.160
1405
+ activation functions and the output is
1406
+
1407
+ 00:19:12.640 --> 00:19:16.720
1408
+ different for different types of
1409
+
1410
+ 00:19:14.160 --> 00:19:18.720
1411
+ activation functions moreover why is an
1412
+
1413
+ 00:19:16.720 --> 00:19:20.960
1414
+ activation function required it is
1415
+
1416
+ 00:19:18.720 --> 00:19:23.520
1417
+ basically required to bring in
1418
+
1419
+ 00:19:20.960 --> 00:19:25.760
1420
+ non-linearity that's the main reason why
1421
+
1422
+ 00:19:23.520 --> 00:19:26.880
1423
+ an activation function is required so
1424
+
1425
+ 00:19:25.760 --> 00:19:28.720
1426
+ what are the different types of
1427
+
1428
+ 00:19:26.880 --> 00:19:30.720
1429
+ activation functions there are several
1430
+
1431
+ 00:19:28.720 --> 00:19:32.720
1432
+ types of activation functions but these
1433
+
1434
+ 00:19:30.720 --> 00:19:35.200
1435
+ are the most common ones these are the
1436
+
1437
+ 00:19:32.720 --> 00:19:37.600
1438
+ ones that are currently in use sigmoid
1439
+
1440
+ 00:19:35.200 --> 00:19:41.440
1441
+ function was one of the early activation
1442
+
1443
+ 00:19:37.600 --> 00:19:44.400
1444
+ functions but today relu has kind of
1445
+
1446
+ 00:19:41.440 --> 00:19:46.960
1447
+ taken over so relu is by far the most
1448
+
1449
+ 00:19:44.400 --> 00:19:49.600
1450
+ popular activation function that is used
1451
+
1452
+ 00:19:46.960 --> 00:19:52.320
1453
+ today but still sigmoid function is
1454
+
1455
+ 00:19:49.600 --> 00:19:54.160
1456
+ still used in many situations these
1457
+
1458
+ 00:19:52.320 --> 00:19:56.400
1459
+ different types of activation functions
1460
+
1461
+ 00:19:54.160 --> 00:19:58.080
1462
+ are used in different situations based
1463
+
1464
+ 00:19:56.400 --> 00:20:00.000
1465
+ on the kind of problem we are trying to
1466
+
1467
+ 00:19:58.080 --> 00:20:01.840
1468
+ solve so what exactly is the difference
1469
+
1470
+ 00:20:00.000 --> 00:20:03.919
1471
+ between these two sigmoid gives the
1472
+
1473
+ 00:20:01.840 --> 00:20:06.799
1474
+ values of the output will be between 0
1475
+
1476
+ 00:20:03.919 --> 00:20:07.760
1477
+ and 1. threshold function is the value
1478
+
1479
+ 00:20:06.799 --> 00:20:10.240
1480
+ will be
1481
+
1482
+ 00:20:07.760 --> 00:20:12.400
1483
+ 0 up to a certain value and beyond that
1484
+
1485
+ 00:20:10.240 --> 00:20:14.960
1486
+ this is also known as a step function
1487
+
1488
+ 00:20:12.400 --> 00:20:17.600
1489
+ and beyond that it will be 1. in case of
1490
+
1491
+ 00:20:14.960 --> 00:20:19.520
1492
+ sigmoid there is a gradual increase but
1493
+
1494
+ 00:20:17.600 --> 00:20:22.000
1495
+ in case of threshold it's like also
1496
+
1497
+ 00:20:19.520 --> 00:20:24.400
1498
+ known as a step function there's a rapid
1499
+
1500
+ 00:20:22.000 --> 00:20:26.080
1501
+ or instantaneous change from zero to one
1502
+
1503
+ 00:20:24.400 --> 00:20:28.400
1504
+ whereas in sigmoid we will see in the
1505
+
1506
+ 00:20:26.080 --> 00:20:30.640
1507
+ next slide there is a gradual increase
1508
+
1509
+ 00:20:28.400 --> 00:20:33.200
1510
+ but the value in this case is between
1511
+
1512
+ 00:20:30.640 --> 00:20:35.600
1513
+ zero and one as well now relu function
1514
+
1515
+ 00:20:33.200 --> 00:20:38.880
1516
+ on the other hand it is equal to
1517
+
1518
+ 00:20:35.600 --> 00:20:42.960
1519
+ basically if the input is 0 or less than
1520
+
1521
+ 00:20:38.880 --> 00:20:46.000
1522
+ 0 then the output is 0 whereas if the
1523
+
1524
+ 00:20:42.960 --> 00:20:48.000
1525
+ input is greater than 0 then the output
1526
+
1527
+ 00:20:46.000 --> 00:20:49.919
1528
+ is equal to the input i know it's a
1529
+
1530
+ 00:20:48.000 --> 00:20:52.400
1531
+ little confusing but in the next slides
1532
+
1533
+ 00:20:49.919 --> 00:20:54.720
1534
+ where we show the relu function it will
1535
+
1536
+ 00:20:52.400 --> 00:20:57.679
1537
+ become clear similarly hyperbolic
1538
+
1539
+ 00:20:54.720 --> 00:21:00.159
1540
+ tangent this is similar to sigmoid in
1541
+
1542
+ 00:20:57.679 --> 00:21:03.360
1543
+ terms of the shape of the function
1544
+
1545
+ 00:21:00.159 --> 00:21:06.400
1546
+ however while sigmoid goes from 0 to 1
1547
+
1548
+ 00:21:03.360 --> 00:21:09.520
1549
+ hyperbolic tangent goes from -1 to 1 and
1550
+
1551
+ 00:21:06.400 --> 00:21:13.760
1552
+ here again the increase or the change
1553
+
1554
+ 00:21:09.520 --> 00:21:15.760
1555
+ from -1 to 1 is gradual and not like
1556
+
1557
+ 00:21:13.760 --> 00:21:18.080
1558
+ threshold or step function where it
1559
+
1560
+ 00:21:15.760 --> 00:21:20.159
1561
+ happens instantaneously so let's take a
1562
+
1563
+ 00:21:18.080 --> 00:21:21.919
1564
+ little detailed look at some of these
1565
+
1566
+ 00:21:20.159 --> 00:21:23.919
1567
+ functions so let's start with the
1568
+
1569
+ 00:21:21.919 --> 00:21:26.559
1570
+ sigmoid function so this is the equation
1571
+
1572
+ 00:21:23.919 --> 00:21:29.679
1573
+ of a sigmoid function which is 1 by 1
1574
+
1575
+ 00:21:26.559 --> 00:21:32.799
1576
+ plus e to the power of minus x so x is
1577
+
1578
+ 00:21:29.679 --> 00:21:36.880
1579
+ the value that is the input it goes from
1580
+
1581
+ 00:21:32.799 --> 00:21:40.000
1582
+ 0 to -1 so this is sigmoid function the
1583
+
1584
+ 00:21:36.880 --> 00:21:42.640
1585
+ equation is phi x is equal to 1 by 1
1586
+
1587
+ 00:21:40.000 --> 00:21:44.400
1588
+ plus e to the power of minus x and as
1589
+
1590
+ 00:21:42.640 --> 00:21:47.520
1591
+ you can see here this is the input on
1592
+
1593
+ 00:21:44.400 --> 00:21:49.600
1594
+ the x-axis as x is where the value is
1595
+
1596
+ 00:21:47.520 --> 00:21:51.440
1597
+ coming from in fact it can also go
1598
+
1599
+ 00:21:49.600 --> 00:21:53.200
1600
+ negative this is negative actually so
1601
+
1602
+ 00:21:51.440 --> 00:21:55.520
1603
+ this is the zero so this is the negative
1604
+
1605
+ 00:21:53.200 --> 00:21:58.720
1606
+ value of x so as x is coming from
1607
+
1608
+ 00:21:55.520 --> 00:22:02.080
1609
+ negative value towards zero the value of
1610
+
1611
+ 00:21:58.720 --> 00:22:05.120
1612
+ the output slowly as it is approaching
1613
+
1614
+ 00:22:02.080 --> 00:22:08.320
1615
+ zero it it slowly and very gently
1616
+
1617
+ 00:22:05.120 --> 00:22:11.600
1618
+ increases and actually at the point let
1619
+
1620
+ 00:22:08.320 --> 00:22:15.919
1621
+ me just use a pen at the point here it
1622
+
1623
+ 00:22:11.600 --> 00:22:19.039
1624
+ is it is 0.5 it is actually 0.5 okay and
1625
+
1626
+ 00:22:15.919 --> 00:22:21.440
1627
+ slowly gradually it increases to 1 as
1628
+
1629
+ 00:22:19.039 --> 00:22:24.400
1630
+ the value of x increases but then as the
1631
+
1632
+ 00:22:21.440 --> 00:22:27.360
1633
+ value of x increases it tapers off it
1634
+
1635
+ 00:22:24.400 --> 00:22:29.840
1636
+ doesn't go beyond one so that is the
1637
+
1638
+ 00:22:27.360 --> 00:22:32.320
1639
+ speciality of sigmoid function so the
1640
+
1641
+ 00:22:29.840 --> 00:22:34.960
1642
+ output value will remain between zero
1643
+
1644
+ 00:22:32.320 --> 00:22:37.360
1645
+ and one it will never go below zero or
1646
+
1647
+ 00:22:34.960 --> 00:22:39.679
1648
+ above one okay then so that is sigmoid
1649
+
1650
+ 00:22:37.360 --> 00:22:42.000
1651
+ function now this is threshold function
1652
+
1653
+ 00:22:39.679 --> 00:22:44.880
1654
+ or this is also referred to as a step
1655
+
1656
+ 00:22:42.000 --> 00:22:46.640
1657
+ function and here we can also set the
1658
+
1659
+ 00:22:44.880 --> 00:22:48.240
1660
+ threshold in this case it is that's why
1661
+
1662
+ 00:22:46.640 --> 00:22:50.720
1663
+ it's called the threshold function
1664
+
1665
+ 00:22:48.240 --> 00:22:52.559
1666
+ normally it is 0 but you can also set a
1667
+
1668
+ 00:22:50.720 --> 00:22:54.240
1669
+ different value for the threshold now
1670
+
1671
+ 00:22:52.559 --> 00:22:57.120
1672
+ the difference between this and the
1673
+
1674
+ 00:22:54.240 --> 00:22:59.840
1675
+ sigmoid is that here the change is rapid
1676
+
1677
+ 00:22:57.120 --> 00:23:02.799
1678
+ or instantaneous as the x value comes
1679
+
1680
+ 00:22:59.840 --> 00:23:06.240
1681
+ from negative up to zero it remains zero
1682
+
1683
+ 00:23:02.799 --> 00:23:08.640
1684
+ and at zero it pretty much immediately
1685
+
1686
+ 00:23:06.240 --> 00:23:11.280
1687
+ increases to 1 okay so this is a
1688
+
1689
+ 00:23:08.640 --> 00:23:13.919
1690
+ mathematical representation of threshold
1691
+
1692
+ 00:23:11.280 --> 00:23:16.799
1693
+ function phi x is equal to 1 if x is
1694
+
1695
+ 00:23:13.919 --> 00:23:18.799
1696
+ greater than equal to 0 and 0 if x is
1697
+
1698
+ 00:23:16.799 --> 00:23:20.640
1699
+ less than 0. so for all negative values
1700
+
1701
+ 00:23:18.799 --> 00:23:23.120
1702
+ it is 0 which since we have set the
1703
+
1704
+ 00:23:20.640 --> 00:23:25.679
1705
+ threshold to be 0 so as soon as it
1706
+
1707
+ 00:23:23.120 --> 00:23:28.640
1708
+ reaches 0 it becomes 1. you see the
1709
+
1710
+ 00:23:25.679 --> 00:23:31.520
1711
+ difference between this and the previous
1712
+
1713
+ 00:23:28.640 --> 00:23:34.720
1714
+ one which is basically the sigmoid where
1715
+
1716
+ 00:23:31.520 --> 00:23:37.120
1717
+ the increase from 0 to 1 is gradual and
1718
+
1719
+ 00:23:34.720 --> 00:23:39.200
1720
+ here it is instantaneous and that's why
1721
+
1722
+ 00:23:37.120 --> 00:23:41.440
1723
+ this is also known as a step function
1724
+
1725
+ 00:23:39.200 --> 00:23:43.679
1726
+ threshold function or step function this
1727
+
1728
+ 00:23:41.440 --> 00:23:46.159
1729
+ is a relu a relu is one of the most
1730
+
1731
+ 00:23:43.679 --> 00:23:48.799
1732
+ popular activation functions today this
1733
+
1734
+ 00:23:46.159 --> 00:23:51.679
1735
+ is the definition of relu phi x is equal
1736
+
1737
+ 00:23:48.799 --> 00:23:54.400
1738
+ to max of x comma zero what it says is
1739
+
1740
+ 00:23:51.679 --> 00:23:55.679
1741
+ if the value of x is less than zero then
1742
+
1743
+ 00:23:54.400 --> 00:23:58.880
1744
+ phi x is
1745
+
1746
+ 00:23:55.679 --> 00:24:03.600
1747
+ zero the moment it increases goes beyond
1748
+
1749
+ 00:23:58.880 --> 00:24:06.720
1750
+ zero the value of phi x is equal to x so
1751
+
1752
+ 00:24:03.600 --> 00:24:08.799
1753
+ it doesn't stop at one actually it goes
1754
+
1755
+ 00:24:06.720 --> 00:24:10.720
1756
+ all the way so as the value of x
1757
+
1758
+ 00:24:08.799 --> 00:24:13.440
1759
+ increases the value of y will also
1760
+
1761
+ 00:24:10.720 --> 00:24:17.760
1762
+ increase infinitely so there is no limit
1763
+
1764
+ 00:24:13.440 --> 00:24:19.760
1765
+ here unlike your sigmoid or threshold or
1766
+
1767
+ 00:24:17.760 --> 00:24:22.559
1768
+ the next one which is basically
1769
+
1770
+ 00:24:19.760 --> 00:24:25.200
1771
+ hyperbolic tangent okay so in case of
1772
+
1773
+ 00:24:22.559 --> 00:24:28.080
1774
+ relu remember there is no upper limit
1775
+
1776
+ 00:24:25.200 --> 00:24:31.039
1777
+ the output is equal to either 0 in case
1778
+
1779
+ 00:24:28.080 --> 00:24:34.240
1780
+ the value of x is negative or it is
1781
+
1782
+ 00:24:31.039 --> 00:24:37.039
1783
+ equal to the value of x so for example
1784
+
1785
+ 00:24:34.240 --> 00:24:39.840
1786
+ here if the value of x is 10 then the
1787
+
1788
+ 00:24:37.039 --> 00:24:42.960
1789
+ value of y is also 10 right okay so that
1790
+
1791
+ 00:24:39.840 --> 00:24:45.679
1792
+ is relu and there are several advantages
1793
+
1794
+ 00:24:42.960 --> 00:24:48.159
1795
+ of relu and it is much more efficient
1796
+
1797
+ 00:24:45.679 --> 00:24:49.840
1798
+ and provides much more accuracy compared
1799
+
1800
+ 00:24:48.159 --> 00:24:51.679
1801
+ to other activation functions like
1802
+
1803
+ 00:24:49.840 --> 00:24:54.320
1804
+ sigmoid and so on so that's the reason
1805
+
1806
+ 00:24:51.679 --> 00:24:56.640
1807
+ it is very popular all right so this is
1808
+
1809
+ 00:24:54.320 --> 00:24:58.640
1810
+ hyperbolic tangent activation function
1811
+
1812
+ 00:24:56.640 --> 00:25:01.279
1813
+ the function looks similar to sigmoid
1814
+
1815
+ 00:24:58.640 --> 00:25:03.360
1816
+ function the curve if you see the shape
1817
+
1818
+ 00:25:01.279 --> 00:25:05.279
1819
+ it looks similar to sigmoid function but
1820
+
1821
+ 00:25:03.360 --> 00:25:08.080
1822
+ the difference between hyperbolic
1823
+
1824
+ 00:25:05.279 --> 00:25:10.799
1825
+ tangent and sigmoid function is that in
1826
+
1827
+ 00:25:08.080 --> 00:25:13.200
1828
+ case of sigmoid the output goes from
1829
+
1830
+ 00:25:10.799 --> 00:25:16.960
1831
+ zero to one whereas in case of
1832
+
1833
+ 00:25:13.200 --> 00:25:18.559
1834
+ hyperbolic tangent it goes from -1 to 1
1835
+
1836
+ 00:25:16.960 --> 00:25:21.360
1837
+ so that is the difference between
1838
+
1839
+ 00:25:18.559 --> 00:25:23.840
1840
+ hyperbolic tangent and sigmoid function
1841
+
1842
+ 00:25:21.360 --> 00:25:26.799
1843
+ otherwise the shape looks very similar
1844
+
1845
+ 00:25:23.840 --> 00:25:29.279
1846
+ there is a gradual increase unlike the
1847
+
1848
+ 00:25:26.799 --> 00:25:31.840
1849
+ step function where there was an instant
1850
+
1851
+ 00:25:29.279 --> 00:25:34.159
1852
+ increase or instant change here again
1853
+
1854
+ 00:25:31.840 --> 00:25:37.679
1855
+ very similar to sigmoid function the
1856
+
1857
+ 00:25:34.159 --> 00:25:40.080
1858
+ value changes gradually from -1 to 1. so
1859
+
1860
+ 00:25:37.679 --> 00:25:42.720
1861
+ this is the equation of hyperbolic
1862
+
1863
+ 00:25:40.080 --> 00:25:44.799
1864
+ tangent activation function yeah so then
1865
+
1866
+ 00:25:42.720 --> 00:25:47.200
1867
+ let's move on this is a diagrammatic
1868
+
1869
+ 00:25:44.799 --> 00:25:50.880
1870
+ representation of the activation
1871
+
1872
+ 00:25:47.200 --> 00:25:53.440
1873
+ function and how the overall data how
1874
+
1875
+ 00:25:50.880 --> 00:25:55.840
1876
+ the overall progression happens from
1877
+
1878
+ 00:25:53.440 --> 00:25:57.679
1879
+ input to the output so we get the input
1880
+
1881
+ 00:25:55.840 --> 00:25:59.919
1882
+ from the input layer by the way the
1883
+
1884
+ 00:25:57.679 --> 00:26:01.440
1885
+ neural network has three layers
1886
+
1887
+ 00:25:59.919 --> 00:26:03.120
1888
+ typically there will be three layers
1889
+
1890
+ 00:26:01.440 --> 00:26:04.880
1891
+ there is an input layer there is an
1892
+
1893
+ 00:26:03.120 --> 00:26:07.600
1894
+ output layer and then you have the
1895
+
1896
+ 00:26:04.880 --> 00:26:10.240
1897
+ hidden layer so the inputs come from the
1898
+
1899
+ 00:26:07.600 --> 00:26:12.240
1900
+ input layer and they get processed in
1901
+
1902
+ 00:26:10.240 --> 00:26:14.400
1903
+ the hidden layer and then you get the
1904
+
1905
+ 00:26:12.240 --> 00:26:16.960
1906
+ output in the output layer so let's take
1907
+
1908
+ 00:26:14.400 --> 00:26:19.840
1909
+ a little bit of a detailed look into the
1910
+
1911
+ 00:26:16.960 --> 00:26:22.880
1912
+ working of a neural network so let's say
1913
+
1914
+ 00:26:19.840 --> 00:26:25.679
1915
+ we want to classify some images between
1916
+
1917
+ 00:26:22.880 --> 00:26:28.400
1918
+ dogs and cats how do we do this this is
1919
+
1920
+ 00:26:25.679 --> 00:26:30.159
1921
+ known as a classification process and we
1922
+
1923
+ 00:26:28.400 --> 00:26:31.600
1924
+ are trying to use neural networks and
1925
+
1926
+ 00:26:30.159 --> 00:26:33.520
1927
+ deep learning to implement this
1928
+
1929
+ 00:26:31.600 --> 00:26:37.440
1930
+ classification so how do we do that so
1931
+
1932
+ 00:26:33.520 --> 00:26:40.159
1933
+ this is how it works so you have four
1934
+
1935
+ 00:26:37.440 --> 00:26:42.559
1936
+ layer neural network there is an input
1937
+
1938
+ 00:26:40.159 --> 00:26:45.440
1939
+ layer there is an output layer and then
1940
+
1941
+ 00:26:42.559 --> 00:26:49.440
1942
+ there are two hidden layers and what we
1943
+
1944
+ 00:26:45.440 --> 00:26:52.080
1945
+ do is we provide labeled training data
1946
+
1947
+ 00:26:49.440 --> 00:26:54.640
1948
+ which means these images are fed to the
1949
+
1950
+ 00:26:52.080 --> 00:26:57.120
1951
+ network with the label saying that okay
1952
+
1953
+ 00:26:54.640 --> 00:27:00.159
1954
+ this is a cat the neural network is
1955
+
1956
+ 00:26:57.120 --> 00:27:02.480
1957
+ allowed to process it and come up with a
1958
+
1959
+ 00:27:00.159 --> 00:27:05.039
1960
+ prediction saying whether it is a cat or
1961
+
1962
+ 00:27:02.480 --> 00:27:07.200
1963
+ a dog and obviously in the beginning
1964
+
1965
+ 00:27:05.039 --> 00:27:09.760
1966
+ there may be mistakes a cat may be
1967
+
1968
+ 00:27:07.200 --> 00:27:12.080
1969
+ classified as a dog so we then say that
1970
+
1971
+ 00:27:09.760 --> 00:27:14.000
1972
+ okay this is wrong this output is wrong
1973
+
1974
+ 00:27:12.080 --> 00:27:16.559
1975
+ but every time it predicts correctly we
1976
+
1977
+ 00:27:14.000 --> 00:27:19.120
1978
+ say yes this output is correct so that
1979
+
1980
+ 00:27:16.559 --> 00:27:21.760
1981
+ learning process so it will go back make
1982
+
1983
+ 00:27:19.120 --> 00:27:24.720
1984
+ some changes to its weights and biases
1985
+
1986
+ 00:27:21.760 --> 00:27:26.799
1987
+ we again feed these inputs and it will
1988
+
1989
+ 00:27:24.720 --> 00:27:28.799
1990
+ give us the output we will check whether
1991
+
1992
+ 00:27:26.799 --> 00:27:31.360
1993
+ it is correct or not and so on so this
1994
+
1995
+ 00:27:28.799 --> 00:27:34.320
1996
+ is a iterative process which is known as
1997
+
1998
+ 00:27:31.360 --> 00:27:36.880
1999
+ the training process so we are training
2000
+
2001
+ 00:27:34.320 --> 00:27:39.440
2002
+ the neural network and what happens in
2003
+
2004
+ 00:27:36.880 --> 00:27:41.760
2005
+ the training process these weights and
2006
+
2007
+ 00:27:39.440 --> 00:27:45.600
2008
+ biases you remember there were weights
2009
+
2010
+ 00:27:41.760 --> 00:27:48.880
2011
+ like w1 w2 and so on so these weights
2012
+
2013
+ 00:27:45.600 --> 00:27:51.679
2014
+ and biases keep changing every time you
2015
+
2016
+ 00:27:48.880 --> 00:27:53.760
2017
+ feed these which is known as an epoch so
2018
+
2019
+ 00:27:51.679 --> 00:27:56.159
2020
+ there are multiple iterations every
2021
+
2022
+ 00:27:53.760 --> 00:27:58.960
2023
+ iteration is known as an epoch and each
2024
+
2025
+ 00:27:56.159 --> 00:28:01.279
2026
+ time the weights are dated to make sure
2027
+
2028
+ 00:27:58.960 --> 00:28:03.679
2029
+ that the maximum number of images are
2030
+
2031
+ 00:28:01.279 --> 00:28:06.080
2032
+ classified correctly so once again what
2033
+
2034
+ 00:28:03.679 --> 00:28:09.600
2035
+ is the input this input could be like
2036
+
2037
+ 00:28:06.080 --> 00:28:12.159
2038
+ 1000 images of cats and dogs and they
2039
+
2040
+ 00:28:09.600 --> 00:28:14.559
2041
+ are labeled because we know which is a
2042
+
2043
+ 00:28:12.159 --> 00:28:17.039
2044
+ cat and which is a dog and we feed those
2045
+
2046
+ 00:28:14.559 --> 00:28:18.960
2047
+ thousand images the neural network will
2048
+
2049
+ 00:28:17.039 --> 00:28:20.799
2050
+ initially assign some weights and biases
2051
+
2052
+ 00:28:18.960 --> 00:28:23.120
2053
+ for each neuron and it will try to
2054
+
2055
+ 00:28:20.799 --> 00:28:25.120
2056
+ process extract the features from the
2057
+
2058
+ 00:28:23.120 --> 00:28:27.279
2059
+ images and it will try to come up with a
2060
+
2061
+ 00:28:25.120 --> 00:28:29.679
2062
+ prediction for each image and that
2063
+
2064
+ 00:28:27.279 --> 00:28:32.240
2065
+ prediction that is calculated by the
2066
+
2067
+ 00:28:29.679 --> 00:28:34.240
2068
+ network is compared with the actual
2069
+
2070
+ 00:28:32.240 --> 00:28:36.399
2071
+ value whether it is a cat or a dog and
2072
+
2073
+ 00:28:34.240 --> 00:28:38.559
2074
+ that's how the error is calculated so
2075
+
2076
+ 00:28:36.399 --> 00:28:41.279
2077
+ let's say there are a thousand images
2078
+
2079
+ 00:28:38.559 --> 00:28:43.200
2080
+ and in the first run only 500 of them
2081
+
2082
+ 00:28:41.279 --> 00:28:45.440
2083
+ have been correctly classified that
2084
+
2085
+ 00:28:43.200 --> 00:28:47.440
2086
+ means we are getting only 50 accuracy so
2087
+
2088
+ 00:28:45.440 --> 00:28:49.760
2089
+ we feed that information back to the
2090
+
2091
+ 00:28:47.440 --> 00:28:51.919
2092
+ network further update these weights and
2093
+
2094
+ 00:28:49.760 --> 00:28:54.480
2095
+ biases for each of the neurons and we
2096
+
2097
+ 00:28:51.919 --> 00:28:56.320
2098
+ run this these inputs once again it will
2099
+
2100
+ 00:28:54.480 --> 00:28:58.000
2101
+ try to calculate extract the features
2102
+
2103
+ 00:28:56.320 --> 00:28:59.840
2104
+ and it will try to predict which of
2105
+
2106
+ 00:28:58.000 --> 00:29:02.399
2107
+ these is cats and dogs and this time
2108
+
2109
+ 00:28:59.840 --> 00:29:04.480
2110
+ let's say out of thousand 700 of them
2111
+
2112
+ 00:29:02.399 --> 00:29:06.720
2113
+ have been predicted correctly so that
2114
+
2115
+ 00:29:04.480 --> 00:29:09.679
2116
+ means in the second iteration the
2117
+
2118
+ 00:29:06.720 --> 00:29:12.559
2119
+ accuracy has increased from 50 to 70
2120
+
2121
+ 00:29:09.679 --> 00:29:15.039
2122
+ percent all right then we go back again
2123
+
2124
+ 00:29:12.559 --> 00:29:17.760
2125
+ we feed this maybe for a third iteration
2126
+
2127
+ 00:29:15.039 --> 00:29:20.799
2128
+ fourth iteration and so on and slowly
2129
+
2130
+ 00:29:17.760 --> 00:29:23.360
2131
+ and steadily the accuracy of this
2132
+
2133
+ 00:29:20.799 --> 00:29:26.080
2134
+ network will keep increasing and it may
2135
+
2136
+ 00:29:23.360 --> 00:29:28.240
2137
+ reach probably you never know 90 95
2138
+
2139
+ 00:29:26.080 --> 00:29:30.240
2140
+ percent and there are several parameters
2141
+
2142
+ 00:29:28.240 --> 00:29:32.720
2143
+ that are known as hyper parameters that
2144
+
2145
+ 00:29:30.240 --> 00:29:34.880
2146
+ need to be changed and tweaked and that
2147
+
2148
+ 00:29:32.720 --> 00:29:37.760
2149
+ is the overall training process and
2150
+
2151
+ 00:29:34.880 --> 00:29:39.200
2152
+ ultimately at some point we say okay you
2153
+
2154
+ 00:29:37.760 --> 00:29:42.080
2155
+ will probably never reach hundred
2156
+
2157
+ 00:29:39.200 --> 00:29:44.159
2158
+ percent accuracy but then we set a limit
2159
+
2160
+ 00:29:42.080 --> 00:29:46.080
2161
+ saying that okay if we receive 95
2162
+
2163
+ 00:29:44.159 --> 00:29:48.399
2164
+ percent accuracy that is good enough for
2165
+
2166
+ 00:29:46.080 --> 00:29:50.320
2167
+ our application and then we say okay our
2168
+
2169
+ 00:29:48.399 --> 00:29:53.120
2170
+ training process is done so that is the
2171
+
2172
+ 00:29:50.320 --> 00:29:55.760
2173
+ way training happens and once the
2174
+
2175
+ 00:29:53.120 --> 00:29:58.399
2176
+ training is done now with the training
2177
+
2178
+ 00:29:55.760 --> 00:30:01.039
2179
+ data set the system has let's say seen
2180
+
2181
+ 00:29:58.399 --> 00:30:03.760
2182
+ all these thousand images therefore what
2183
+
2184
+ 00:30:01.039 --> 00:30:05.840
2185
+ we do is the next step like in any
2186
+
2187
+ 00:30:03.760 --> 00:30:08.399
2188
+ normal machine learning process we do
2189
+
2190
+ 00:30:05.840 --> 00:30:10.799
2191
+ the testing where we take a fresh set of
2192
+
2193
+ 00:30:08.399 --> 00:30:13.039
2194
+ images and we feed it to the network the
2195
+
2196
+ 00:30:10.799 --> 00:30:14.880
2197
+ fresh set which it has not seen before
2198
+
2199
+ 00:30:13.039 --> 00:30:16.559
2200
+ as a part of the training process and
2201
+
2202
+ 00:30:14.880 --> 00:30:18.159
2203
+ this is again nothing new in deep
2204
+
2205
+ 00:30:16.559 --> 00:30:20.720
2206
+ learning this was there in machine
2207
+
2208
+ 00:30:18.159 --> 00:30:23.440
2209
+ learning as well so you feed the test
2210
+
2211
+ 00:30:20.720 --> 00:30:25.520
2212
+ images and then find out whether we are
2213
+
2214
+ 00:30:23.440 --> 00:30:27.600
2215
+ getting a similar accuracy or not so
2216
+
2217
+ 00:30:25.520 --> 00:30:29.520
2218
+ maybe that accuracy may reduce a little
2219
+
2220
+ 00:30:27.600 --> 00:30:31.840
2221
+ bit while training you may get 98
2222
+
2223
+ 00:30:29.520 --> 00:30:33.760
2224
+ percent and then for test you may get 95
2225
+
2226
+ 00:30:31.840 --> 00:30:36.480
2227
+ percent but there shouldn't be a drastic
2228
+
2229
+ 00:30:33.760 --> 00:30:38.880
2230
+ drop like for example you get 98 in
2231
+
2232
+ 00:30:36.480 --> 00:30:40.799
2233
+ training and then you get 50 or 40
2234
+
2235
+ 00:30:38.880 --> 00:30:43.279
2236
+ percent with the test that means your
2237
+
2238
+ 00:30:40.799 --> 00:30:46.320
2239
+ network has not learned you may have to
2240
+
2241
+ 00:30:43.279 --> 00:30:47.919
2242
+ retrain your network so that is the way
2243
+
2244
+ 00:30:46.320 --> 00:30:50.799
2245
+ neural network training works and
2246
+
2247
+ 00:30:47.919 --> 00:30:53.279
2248
+ remember the whole process is about
2249
+
2250
+ 00:30:50.799 --> 00:30:55.679
2251
+ changing these weights and biases and
2252
+
2253
+ 00:30:53.279 --> 00:30:57.520
2254
+ coming up with the optimal values of
2255
+
2256
+ 00:30:55.679 --> 00:31:00.240
2257
+ these weights and biases so that the
2258
+
2259
+ 00:30:57.520 --> 00:31:02.960
2260
+ accuracy is the maximum possible all
2261
+
2262
+ 00:31:00.240 --> 00:31:04.960
2263
+ right so a little bit more detail about
2264
+
2265
+ 00:31:02.960 --> 00:31:07.520
2266
+ how this whole thing works so this is
2267
+
2268
+ 00:31:04.960 --> 00:31:09.840
2269
+ known as forward propagation which is
2270
+
2271
+ 00:31:07.520 --> 00:31:12.320
2272
+ the data or the information is going in
2273
+
2274
+ 00:31:09.840 --> 00:31:15.279
2275
+ the forward direction the inputs are
2276
+
2277
+ 00:31:12.320 --> 00:31:18.399
2278
+ taken weighted summation is done bias is
2279
+
2280
+ 00:31:15.279 --> 00:31:21.039
2281
+ added here and then that is fed to the
2282
+
2283
+ 00:31:18.399 --> 00:31:23.200
2284
+ activation function and then that is
2285
+
2286
+ 00:31:21.039 --> 00:31:25.360
2287
+ that comes out as an output so that is
2288
+
2289
+ 00:31:23.200 --> 00:31:27.360
2290
+ forward propagation and the output is
2291
+
2292
+ 00:31:25.360 --> 00:31:29.039
2293
+ compared with the actual value and that
2294
+
2295
+ 00:31:27.360 --> 00:31:31.200
2296
+ will give us the error the difference
2297
+
2298
+ 00:31:29.039 --> 00:31:33.679
2299
+ between them is the error and in
2300
+
2301
+ 00:31:31.200 --> 00:31:36.720
2302
+ technical terms that is also known as
2303
+
2304
+ 00:31:33.679 --> 00:31:38.880
2305
+ our cost function and this is what we
2306
+
2307
+ 00:31:36.720 --> 00:31:40.559
2308
+ would like to minimize there are
2309
+
2310
+ 00:31:38.880 --> 00:31:44.000
2311
+ different ways of defining the cost
2312
+
2313
+ 00:31:40.559 --> 00:31:47.200
2314
+ function but one of the simplest ways is
2315
+
2316
+ 00:31:44.000 --> 00:31:49.120
2317
+ mean square error so it is nothing but
2318
+
2319
+ 00:31:47.200 --> 00:31:51.919
2320
+ the square of the difference of the
2321
+
2322
+ 00:31:49.120 --> 00:31:53.679
2323
+ errors or the sum of the squares of the
2324
+
2325
+ 00:31:51.919 --> 00:31:56.240
2326
+ difference of the errors and this is
2327
+
2328
+ 00:31:53.679 --> 00:31:57.760
2329
+ also nothing new we have probably if
2330
+
2331
+ 00:31:56.240 --> 00:31:59.760
2332
+ you're familiar with machine learning
2333
+
2334
+ 00:31:57.760 --> 00:32:02.159
2335
+ you must have come across this mean
2336
+
2337
+ 00:31:59.760 --> 00:32:04.320
2338
+ square now there are different ways of
2339
+
2340
+ 00:32:02.159 --> 00:32:06.240
2341
+ defining cost function it need not
2342
+
2343
+ 00:32:04.320 --> 00:32:08.720
2344
+ always be the mean square error but the
2345
+
2346
+ 00:32:06.240 --> 00:32:11.760
2347
+ most common one is this so you define
2348
+
2349
+ 00:32:08.720 --> 00:32:15.200
2350
+ this cost function and you ask the
2351
+
2352
+ 00:32:11.760 --> 00:32:17.600
2353
+ system to minimize this error so we use
2354
+
2355
+ 00:32:15.200 --> 00:32:21.039
2356
+ what is known as an optimization
2357
+
2358
+ 00:32:17.600 --> 00:32:23.519
2359
+ function to minimize this error and the
2360
+
2361
+ 00:32:21.039 --> 00:32:25.840
2362
+ error itself sent back to the system as
2363
+
2364
+ 00:32:23.519 --> 00:32:27.600
2365
+ feedback and that is known as back
2366
+
2367
+ 00:32:25.840 --> 00:32:30.080
2368
+ propagation and so this is the cost
2369
+
2370
+ 00:32:27.600 --> 00:32:32.880
2371
+ function and how do we optimize the cost
2372
+
2373
+ 00:32:30.080 --> 00:32:35.919
2374
+ function we use what is known as
2375
+
2376
+ 00:32:32.880 --> 00:32:39.519
2377
+ gradient descent so the gradient descent
2378
+
2379
+ 00:32:35.919 --> 00:32:42.480
2380
+ mechanism identifies how to change the
2381
+
2382
+ 00:32:39.519 --> 00:32:45.760
2383
+ weights and biases so that the cost
2384
+
2385
+ 00:32:42.480 --> 00:32:47.919
2386
+ function is minimized and there is also
2387
+
2388
+ 00:32:45.760 --> 00:32:50.159
2389
+ what is known as the rate or the
2390
+
2391
+ 00:32:47.919 --> 00:32:53.120
2392
+ learning rate that is what is shown here
2393
+
2394
+ 00:32:50.159 --> 00:32:55.919
2395
+ as slower and faster so you need to
2396
+
2397
+ 00:32:53.120 --> 00:32:59.360
2398
+ specify what should be the learning rate
2399
+
2400
+ 00:32:55.919 --> 00:33:02.480
2401
+ now if the learning rate is very small
2402
+
2403
+ 00:32:59.360 --> 00:33:04.480
2404
+ then it will probably take very long to
2405
+
2406
+ 00:33:02.480 --> 00:33:07.279
2407
+ train whereas if the learning rate is
2408
+
2409
+ 00:33:04.480 --> 00:33:09.840
2410
+ very high then it will appear to be
2411
+
2412
+ 00:33:07.279 --> 00:33:12.159
2413
+ faster but then it will probably never
2414
+
2415
+ 00:33:09.840 --> 00:33:14.480
2416
+ what is known as converge now what is
2417
+
2418
+ 00:33:12.159 --> 00:33:17.760
2419
+ convergence now we are talking about a
2420
+
2421
+ 00:33:14.480 --> 00:33:20.159
2422
+ few terms here convergence is like this
2423
+
2424
+ 00:33:17.760 --> 00:33:24.000
2425
+ this is a representation of convergence
2426
+
2427
+ 00:33:20.159 --> 00:33:26.240
2428
+ so the whole idea of gradient descent is
2429
+
2430
+ 00:33:24.000 --> 00:33:28.640
2431
+ to optimize the cost function or
2432
+
2433
+ 00:33:26.240 --> 00:33:30.880
2434
+ minimize the cost function in order to
2435
+
2436
+ 00:33:28.640 --> 00:33:34.000
2437
+ do that we need to represent the cost
2438
+
2439
+ 00:33:30.880 --> 00:33:36.480
2440
+ function as this curve we need to come
2441
+
2442
+ 00:33:34.000 --> 00:33:38.960
2443
+ to this minimum value that is what is
2444
+
2445
+ 00:33:36.480 --> 00:33:41.840
2446
+ known as the minimization of the cost
2447
+
2448
+ 00:33:38.960 --> 00:33:44.720
2449
+ function now what happens if we have the
2450
+
2451
+ 00:33:41.840 --> 00:33:48.000
2452
+ learning rate very small is that it will
2453
+
2454
+ 00:33:44.720 --> 00:33:51.200
2455
+ take very long to come to this point on
2456
+
2457
+ 00:33:48.000 --> 00:33:53.279
2458
+ the other hand if you have large higher
2459
+
2460
+ 00:33:51.200 --> 00:33:56.159
2461
+ learning rate what will happen is
2462
+
2463
+ 00:33:53.279 --> 00:33:58.559
2464
+ instead of stopping here it will cross
2465
+
2466
+ 00:33:56.159 --> 00:34:01.279
2467
+ over because the learning rate is high
2468
+
2469
+ 00:33:58.559 --> 00:34:03.440
2470
+ and then it has to come back so it will
2471
+
2472
+ 00:34:01.279 --> 00:34:05.440
2473
+ result in what is known as like an
2474
+
2475
+ 00:34:03.440 --> 00:34:07.760
2476
+ oscillation so it will never come to
2477
+
2478
+ 00:34:05.440 --> 00:34:10.639
2479
+ this point which is known as convergence
2480
+
2481
+ 00:34:07.760 --> 00:34:13.040
2482
+ instead it will go back and forth so
2483
+
2484
+ 00:34:10.639 --> 00:34:14.960
2485
+ these are known as hyper parameters the
2486
+
2487
+ 00:34:13.040 --> 00:34:17.520
2488
+ learning rate and so on and these have
2489
+
2490
+ 00:34:14.960 --> 00:34:20.639
2491
+ to be those numbers or those values we
2492
+
2493
+ 00:34:17.520 --> 00:34:23.040
2494
+ can determine typically using trial and
2495
+
2496
+ 00:34:20.639 --> 00:34:25.359
2497
+ error out of experience we we try to
2498
+
2499
+ 00:34:23.040 --> 00:34:28.639
2500
+ find out these values so that is the
2501
+
2502
+ 00:34:25.359 --> 00:34:30.560
2503
+ gradient descent mechanism to optimize
2504
+
2505
+ 00:34:28.639 --> 00:34:34.399
2506
+ the cost function and that is what is
2507
+
2508
+ 00:34:30.560 --> 00:34:36.560
2509
+ used to train our neural network this is
2510
+
2511
+ 00:34:34.399 --> 00:34:38.720
2512
+ another representation of how the
2513
+
2514
+ 00:34:36.560 --> 00:34:41.200
2515
+ training process works and here in this
2516
+
2517
+ 00:34:38.720 --> 00:34:44.320
2518
+ example we are trying to classify these
2519
+
2520
+ 00:34:41.200 --> 00:34:46.960
2521
+ images whether they are cats or dogs and
2522
+
2523
+ 00:34:44.320 --> 00:34:49.599
2524
+ as you can see actually each image is
2525
+
2526
+ 00:34:46.960 --> 00:34:54.000
2527
+ fed in each time one image is fed rather
2528
+
2529
+ 00:34:49.599 --> 00:34:56.960
2530
+ and these values of x1 x2 up to xn are
2531
+
2532
+ 00:34:54.000 --> 00:34:59.280
2533
+ the pixel values within this image okay
2534
+
2535
+ 00:34:56.960 --> 00:35:01.920
2536
+ so those values are then taken and for
2537
+
2538
+ 00:34:59.280 --> 00:35:04.320
2539
+ each of those values a weight is
2540
+
2541
+ 00:35:01.920 --> 00:35:06.079
2542
+ multiplied and then it goes to the next
2543
+
2544
+ 00:35:04.320 --> 00:35:08.480
2545
+ layer and then to the next layer and so
2546
+
2547
+ 00:35:06.079 --> 00:35:10.880
2548
+ on ultimately it comes as the output
2549
+
2550
+ 00:35:08.480 --> 00:35:13.839
2551
+ layer and it gives an output as whether
2552
+
2553
+ 00:35:10.880 --> 00:35:16.720
2554
+ it is a dog or a cat remember the output
2555
+
2556
+ 00:35:13.839 --> 00:35:19.520
2557
+ will never be a named output so these
2558
+
2559
+ 00:35:16.720 --> 00:35:22.400
2560
+ would be like a zero or a one and we say
2561
+
2562
+ 00:35:19.520 --> 00:35:24.400
2563
+ okay zero corresponds to dogs and one
2564
+
2565
+ 00:35:22.400 --> 00:35:26.640
2566
+ corresponds to catch so that is the way
2567
+
2568
+ 00:35:24.400 --> 00:35:28.800
2569
+ it typically happens this is a binary
2570
+
2571
+ 00:35:26.640 --> 00:35:31.280
2572
+ classification we have similar
2573
+
2574
+ 00:35:28.800 --> 00:35:32.960
2575
+ situations where there can be multiple
2576
+
2577
+ 00:35:31.280 --> 00:35:34.960
2578
+ classes which means that there will be
2579
+
2580
+ 00:35:32.960 --> 00:35:38.160
2581
+ multiple more neurons in the output
2582
+
2583
+ 00:35:34.960 --> 00:35:39.920
2584
+ layer okay so this is once again a quick
2585
+
2586
+ 00:35:38.160 --> 00:35:41.839
2587
+ representation of how the forward
2588
+
2589
+ 00:35:39.920 --> 00:35:44.400
2590
+ propagation and the backward propagation
2591
+
2592
+ 00:35:41.839 --> 00:35:46.640
2593
+ works so the information is going
2594
+
2595
+ 00:35:44.400 --> 00:35:49.119
2596
+ in this direction which is basically the
2597
+
2598
+ 00:35:46.640 --> 00:35:50.079
2599
+ forward propagation and at the output
2600
+
2601
+ 00:35:49.119 --> 00:35:53.200
2602
+ level
2603
+
2604
+ 00:35:50.079 --> 00:35:56.480
2605
+ we find out what is the cost function
2606
+
2607
+ 00:35:53.200 --> 00:35:58.560
2608
+ the difference is basically sent back as
2609
+
2610
+ 00:35:56.480 --> 00:36:01.040
2611
+ part of the backward propagation and
2612
+
2613
+ 00:35:58.560 --> 00:36:03.520
2614
+ gradient descent then adjust the weights
2615
+
2616
+ 00:36:01.040 --> 00:36:06.160
2617
+ and biases for the next iteration this
2618
+
2619
+ 00:36:03.520 --> 00:36:09.280
2620
+ happens iteratively till the cost
2621
+
2622
+ 00:36:06.160 --> 00:36:11.680
2623
+ function is minimized and that is when
2624
+
2625
+ 00:36:09.280 --> 00:36:13.760
2626
+ we say the whole the network has
2627
+
2628
+ 00:36:11.680 --> 00:36:16.160
2629
+ converged or the training process has
2630
+
2631
+ 00:36:13.760 --> 00:36:18.880
2632
+ converged and there can be situations
2633
+
2634
+ 00:36:16.160 --> 00:36:21.599
2635
+ where convergence may not happen in rare
2636
+
2637
+ 00:36:18.880 --> 00:36:24.000
2638
+ cases but by and large the network will
2639
+
2640
+ 00:36:21.599 --> 00:36:26.320
2641
+ converge and after maybe a few
2642
+
2643
+ 00:36:24.000 --> 00:36:28.160
2644
+ iterations it could be tens of
2645
+
2646
+ 00:36:26.320 --> 00:36:30.160
2647
+ iterations or hundreds of iterations
2648
+
2649
+ 00:36:28.160 --> 00:36:32.800
2650
+ depending on what exactly the number of
2651
+
2652
+ 00:36:30.160 --> 00:36:35.599
2653
+ iterations can vary and then we say okay
2654
+
2655
+ 00:36:32.800 --> 00:36:38.079
2656
+ we are getting a certain accuracy and we
2657
+
2658
+ 00:36:35.599 --> 00:36:40.800
2659
+ say that is our threshold maybe 90
2660
+
2661
+ 00:36:38.079 --> 00:36:42.880
2662
+ accuracy we stop at that and we say that
2663
+
2664
+ 00:36:40.800 --> 00:36:44.640
2665
+ the system is trained the trained model
2666
+
2667
+ 00:36:42.880 --> 00:36:47.440
2668
+ is then deployed for production and so
2669
+
2670
+ 00:36:44.640 --> 00:36:49.920
2671
+ on so that is the way the neural network
2672
+
2673
+ 00:36:47.440 --> 00:36:53.200
2674
+ training happens okay so that is the way
2675
+
2676
+ 00:36:49.920 --> 00:36:56.079
2677
+ classification works in deep learning
2678
+
2679
+ 00:36:53.200 --> 00:36:59.280
2680
+ using neural network and this slide is
2681
+
2682
+ 00:36:56.079 --> 00:37:01.520
2683
+ an animation of this whole process as
2684
+
2685
+ 00:36:59.280 --> 00:37:04.079
2686
+ you can see the forward propagation the
2687
+
2688
+ 00:37:01.520 --> 00:37:06.160
2689
+ data is going forward from the input
2690
+
2691
+ 00:37:04.079 --> 00:37:07.359
2692
+ layer to the output layer and there is
2693
+
2694
+ 00:37:06.160 --> 00:37:10.000
2695
+ an output
2696
+
2697
+ 00:37:07.359 --> 00:37:12.960
2698
+ and the error is calculated the cost
2699
+
2700
+ 00:37:10.000 --> 00:37:15.359
2701
+ function is calculated and that is fed
2702
+
2703
+ 00:37:12.960 --> 00:37:18.320
2704
+ back as a part of backward propagation
2705
+
2706
+ 00:37:15.359 --> 00:37:20.800
2707
+ and that whole process repeats once
2708
+
2709
+ 00:37:18.320 --> 00:37:23.359
2710
+ again okay so remember in neural
2711
+
2712
+ 00:37:20.800 --> 00:37:27.520
2713
+ networks the training process is nothing
2714
+
2715
+ 00:37:23.359 --> 00:37:29.760
2716
+ but the finding the best values of the
2717
+
2718
+ 00:37:27.520 --> 00:37:32.400
2719
+ weights and biases for each and every
2720
+
2721
+ 00:37:29.760 --> 00:37:34.960
2722
+ neuron in the network that's all
2723
+
2724
+ 00:37:32.400 --> 00:37:37.760
2725
+ training of neural network consists of
2726
+
2727
+ 00:37:34.960 --> 00:37:40.960
2728
+ finding the optimal values of the
2729
+
2730
+ 00:37:37.760 --> 00:37:44.800
2731
+ weights and biases so that the accuracy
2732
+
2733
+ 00:37:40.960 --> 00:37:47.040
2734
+ is maximum all right so with that we
2735
+
2736
+ 00:37:44.800 --> 00:37:51.800
2737
+ come to the end of the session we all
2738
+
2739
+ 00:37:47.040 --> 00:37:51.800
2740
+ have a great day thank you very much
2741
+
2742
+ 00:37:53.839 --> 00:37:57.359
2743
+ hi there if you like this video
2744
+
2745
+ 00:37:55.680 --> 00:38:00.000
2746
+ subscribe to the simply learn youtube
2747
+
2748
+ 00:37:57.359 --> 00:38:02.160
2749
+ channel and click here to watch similar
2750
+
2751
+ 00:38:00.000 --> 00:38:05.480
2752
+ videos turn it up and get certified
2753
+
2754
+ 00:38:02.160 --> 00:38:05.480
2755
+ click here
2756
+
2757
+
data/subtitles/Machine Learning.vtt ADDED
@@ -0,0 +1,621 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ WEBVTT - Subtitles by: DownloadYoutubeSubtitles.com
2
+
3
+ 00:00:00.240 --> 00:00:03.760
4
+ we know humans learn from their past
5
+
6
+ 00:00:02.320 --> 00:00:05.680
7
+ experiences
8
+
9
+ 00:00:03.760 --> 00:00:07.359
10
+ and machines follow instructions given
11
+
12
+ 00:00:05.680 --> 00:00:09.599
13
+ by humans
14
+
15
+ 00:00:07.359 --> 00:00:11.519
16
+ but what if humans can train the
17
+
18
+ 00:00:09.599 --> 00:00:14.000
19
+ machines to learn from the past data and
20
+
21
+ 00:00:11.519 --> 00:00:15.839
22
+ do what humans can do and much faster
23
+
24
+ 00:00:14.000 --> 00:00:17.760
25
+ well that's called machine learning but
26
+
27
+ 00:00:15.839 --> 00:00:20.000
28
+ it's a lot more than just learning it's
29
+
30
+ 00:00:17.760 --> 00:00:22.400
31
+ also about understanding and reasoning
32
+
33
+ 00:00:20.000 --> 00:00:24.240
34
+ so today we will learn about the basics
35
+
36
+ 00:00:22.400 --> 00:00:26.800
37
+ of machine learning
38
+
39
+ 00:00:24.240 --> 00:00:28.800
40
+ so that's paul he loves listening to new
41
+
42
+ 00:00:26.800 --> 00:00:30.880
43
+ songs
44
+
45
+ 00:00:28.800 --> 00:00:33.120
46
+ he either likes them or dislikes them
47
+
48
+ 00:00:30.880 --> 00:00:34.880
49
+ paul decides this on the basis of the
50
+
51
+ 00:00:33.120 --> 00:00:36.000
52
+ song's tempo
53
+
54
+ 00:00:34.880 --> 00:00:39.040
55
+ genre
56
+
57
+ 00:00:36.000 --> 00:00:41.440
58
+ intensity and the gender of voice for
59
+
60
+ 00:00:39.040 --> 00:00:44.559
61
+ simplicity let's just use tempo and
62
+
63
+ 00:00:41.440 --> 00:00:47.680
64
+ intensity for now so here tempo is on
65
+
66
+ 00:00:44.559 --> 00:00:50.320
67
+ the x axis ranging from relaxed to fast
68
+
69
+ 00:00:47.680 --> 00:00:53.280
70
+ whereas intensity is on the y axis
71
+
72
+ 00:00:50.320 --> 00:00:56.879
73
+ ranging from light to soaring we see
74
+
75
+ 00:00:53.280 --> 00:00:59.840
76
+ that paul likes the song with fast tempo
77
+
78
+ 00:00:56.879 --> 00:01:02.800
79
+ and soaring intensity while he dislikes
80
+
81
+ 00:00:59.840 --> 00:01:05.280
82
+ the song with relaxed tempo and light
83
+
84
+ 00:01:02.800 --> 00:01:07.360
85
+ intensity so now we know paul's choices
86
+
87
+ 00:01:05.280 --> 00:01:10.720
88
+ let's say paul listens to a new song
89
+
90
+ 00:01:07.360 --> 00:01:13.680
91
+ let's name it as song a song a has fast
92
+
93
+ 00:01:10.720 --> 00:01:15.840
94
+ tempo and a soaring intensity so it lies
95
+
96
+ 00:01:13.680 --> 00:01:17.759
97
+ somewhere here looking at the data can
98
+
99
+ 00:01:15.840 --> 00:01:20.560
100
+ you guess whether paul will like the
101
+
102
+ 00:01:17.759 --> 00:01:23.040
103
+ song or not correct so paul likes this
104
+
105
+ 00:01:20.560 --> 00:01:25.119
106
+ song by looking at paul's past choices
107
+
108
+ 00:01:23.040 --> 00:01:28.400
109
+ we were able to classify the unknown
110
+
111
+ 00:01:25.119 --> 00:01:30.880
112
+ song very easily right let's say now
113
+
114
+ 00:01:28.400 --> 00:01:33.439
115
+ paul listens to a new song let's label
116
+
117
+ 00:01:30.880 --> 00:01:36.720
118
+ it as song b so song b
119
+
120
+ 00:01:33.439 --> 00:01:39.439
121
+ lies somewhere here with medium tempo
122
+
123
+ 00:01:36.720 --> 00:01:42.400
124
+ and medium intensity neither relaxed nor
125
+
126
+ 00:01:39.439 --> 00:01:44.479
127
+ fast neither light nor soaring now can
128
+
129
+ 00:01:42.400 --> 00:01:46.560
130
+ you guess whether paul likes it or not
131
+
132
+ 00:01:44.479 --> 00:01:49.200
133
+ not able to guess whether paul will like
134
+
135
+ 00:01:46.560 --> 00:01:52.159
136
+ it or dislike it are the choices unclear
137
+
138
+ 00:01:49.200 --> 00:01:54.640
139
+ correct we could easily classify song a
140
+
141
+ 00:01:52.159 --> 00:01:57.200
142
+ but when the choice became complicated
143
+
144
+ 00:01:54.640 --> 00:01:59.119
145
+ as in the case of song b yes and that's
146
+
147
+ 00:01:57.200 --> 00:02:01.920
148
+ where machine learning comes in let's
149
+
150
+ 00:01:59.119 --> 00:02:04.240
151
+ see how in the same example for song b
152
+
153
+ 00:02:01.920 --> 00:02:06.719
154
+ if we draw a circle around the song b we
155
+
156
+ 00:02:04.240 --> 00:02:09.440
157
+ see that there are four votes for like
158
+
159
+ 00:02:06.719 --> 00:02:11.760
160
+ whereas one would for dislike if we go
161
+
162
+ 00:02:09.440 --> 00:02:13.440
163
+ for the majority votes we can say that
164
+
165
+ 00:02:11.760 --> 00:02:15.120
166
+ paul will definitely like the song
167
+
168
+ 00:02:13.440 --> 00:02:17.120
169
+ that's all this was a basic machine
170
+
171
+ 00:02:15.120 --> 00:02:19.200
172
+ learning algorithm also it's called k
173
+
174
+ 00:02:17.120 --> 00:02:21.599
175
+ nearest neighbors so this is just a
176
+
177
+ 00:02:19.200 --> 00:02:24.319
178
+ small example in one of the many machine
179
+
180
+ 00:02:21.599 --> 00:02:27.440
181
+ learning algorithms quite easy right
182
+
183
+ 00:02:24.319 --> 00:02:29.840
184
+ believe me it is but what happens when
185
+
186
+ 00:02:27.440 --> 00:02:31.760
187
+ the choices become complicated as in the
188
+
189
+ 00:02:29.840 --> 00:02:33.920
190
+ case of song b that's when machine
191
+
192
+ 00:02:31.760 --> 00:02:35.920
193
+ learning comes in it learns the data
194
+
195
+ 00:02:33.920 --> 00:02:38.160
196
+ builds the prediction model and when the
197
+
198
+ 00:02:35.920 --> 00:02:40.640
199
+ new data point comes in it can easily
200
+
201
+ 00:02:38.160 --> 00:02:43.200
202
+ predict for it more the data better the
203
+
204
+ 00:02:40.640 --> 00:02:45.360
205
+ model higher will be the accuracy there
206
+
207
+ 00:02:43.200 --> 00:02:47.599
208
+ are many ways in which the machine
209
+
210
+ 00:02:45.360 --> 00:02:49.599
211
+ learns it could be either supervised
212
+
213
+ 00:02:47.599 --> 00:02:51.280
214
+ learning unsupervised learning or
215
+
216
+ 00:02:49.599 --> 00:02:53.680
217
+ reinforcement learning let's first
218
+
219
+ 00:02:51.280 --> 00:02:55.519
220
+ quickly understand supervised learning
221
+
222
+ 00:02:53.680 --> 00:02:57.280
223
+ suppose your friend gives you one
224
+
225
+ 00:02:55.519 --> 00:03:00.000
226
+ million coins of three different
227
+
228
+ 00:02:57.280 --> 00:03:02.080
229
+ currencies say one rupee one euro and
230
+
231
+ 00:03:00.000 --> 00:03:04.480
232
+ one dirham each coin has different
233
+
234
+ 00:03:02.080 --> 00:03:07.120
235
+ weights for example a coin of one rupee
236
+
237
+ 00:03:04.480 --> 00:03:09.519
238
+ weighs three grams one euro weighs seven
239
+
240
+ 00:03:07.120 --> 00:03:11.440
241
+ grams and one dirham weighs four grams
242
+
243
+ 00:03:09.519 --> 00:03:13.920
244
+ your model will predict the currency of
245
+
246
+ 00:03:11.440 --> 00:03:16.400
247
+ the coin here your weight becomes the
248
+
249
+ 00:03:13.920 --> 00:03:18.400
250
+ feature of coins while currency becomes
251
+
252
+ 00:03:16.400 --> 00:03:21.040
253
+ the label when you feed this data to the
254
+
255
+ 00:03:18.400 --> 00:03:23.680
256
+ machine learning model it learns which
257
+
258
+ 00:03:21.040 --> 00:03:26.319
259
+ feature is associated with which label
260
+
261
+ 00:03:23.680 --> 00:03:28.959
262
+ for example it will learn that if a coin
263
+
264
+ 00:03:26.319 --> 00:03:30.560
265
+ is of 3 grams it will be a 1 rupee coin
266
+
267
+ 00:03:28.959 --> 00:03:32.879
268
+ let's give a new coin to the machine on
269
+
270
+ 00:03:30.560 --> 00:03:34.959
271
+ the basis of the weight of the new coin
272
+
273
+ 00:03:32.879 --> 00:03:37.599
274
+ your model will predict the currency
275
+
276
+ 00:03:34.959 --> 00:03:40.000
277
+ hence supervised learning uses labeled
278
+
279
+ 00:03:37.599 --> 00:03:42.400
280
+ data to train the model here the machine
281
+
282
+ 00:03:40.000 --> 00:03:44.159
283
+ knew the features of the object and also
284
+
285
+ 00:03:42.400 --> 00:03:46.159
286
+ the labels associated with those
287
+
288
+ 00:03:44.159 --> 00:03:47.760
289
+ features on this note let's move to
290
+
291
+ 00:03:46.159 --> 00:03:49.760
292
+ unsupervised learning and see the
293
+
294
+ 00:03:47.760 --> 00:03:51.440
295
+ difference suppose you have cricket data
296
+
297
+ 00:03:49.760 --> 00:03:53.760
298
+ set of various players with their
299
+
300
+ 00:03:51.440 --> 00:03:56.319
301
+ respective scores and wickets taken when
302
+
303
+ 00:03:53.760 --> 00:03:58.640
304
+ you feed this data set to the machine
305
+
306
+ 00:03:56.319 --> 00:04:00.959
307
+ the machine identifies the pattern of
308
+
309
+ 00:03:58.640 --> 00:04:02.319
310
+ player performance so it plots this data
311
+
312
+ 00:04:00.959 --> 00:04:04.799
313
+ with the respective wickets on the
314
+
315
+ 00:04:02.319 --> 00:04:06.799
316
+ x-axis while runs on the y-axis while
317
+
318
+ 00:04:04.799 --> 00:04:08.879
319
+ looking at the data you'll clearly see
320
+
321
+ 00:04:06.799 --> 00:04:10.879
322
+ that there are two clusters the one
323
+
324
+ 00:04:08.879 --> 00:04:13.280
325
+ cluster are the players who scored
326
+
327
+ 00:04:10.879 --> 00:04:15.680
328
+ higher runs and took less wickets while
329
+
330
+ 00:04:13.280 --> 00:04:18.000
331
+ the other cluster is of the players who
332
+
333
+ 00:04:15.680 --> 00:04:20.560
334
+ scored less runs but took many wickets
335
+
336
+ 00:04:18.000 --> 00:04:22.800
337
+ so here we interpret these two clusters
338
+
339
+ 00:04:20.560 --> 00:04:24.800
340
+ as batsmen and bowlers the important
341
+
342
+ 00:04:22.800 --> 00:04:27.520
343
+ point to note here is that there were no
344
+
345
+ 00:04:24.800 --> 00:04:29.759
346
+ labels of batsmen and bowlers hence the
347
+
348
+ 00:04:27.520 --> 00:04:31.360
349
+ learning with unlabeled data is
350
+
351
+ 00:04:29.759 --> 00:04:33.199
352
+ unsupervised learning so we saw
353
+
354
+ 00:04:31.360 --> 00:04:35.199
355
+ supervised learning where the data was
356
+
357
+ 00:04:33.199 --> 00:04:37.520
358
+ labeled and the unsupervised learning
359
+
360
+ 00:04:35.199 --> 00:04:39.360
361
+ where the data was unlabeled and then
362
+
363
+ 00:04:37.520 --> 00:04:41.280
364
+ there is reinforcement learning which is
365
+
366
+ 00:04:39.360 --> 00:04:42.560
367
+ a reward based learning or we can say
368
+
369
+ 00:04:41.280 --> 00:04:44.639
370
+ that it works on the principle of
371
+
372
+ 00:04:42.560 --> 00:04:46.960
373
+ feedback here let's say you provide the
374
+
375
+ 00:04:44.639 --> 00:04:49.919
376
+ system with an image of a dog and ask it
377
+
378
+ 00:04:46.960 --> 00:04:52.080
379
+ to identify it the system identifies it
380
+
381
+ 00:04:49.919 --> 00:04:54.000
382
+ as a cat so you give a negative feedback
383
+
384
+ 00:04:52.080 --> 00:04:55.600
385
+ to the machine saying that it's a dog's
386
+
387
+ 00:04:54.000 --> 00:04:57.759
388
+ image the machine will learn from the
389
+
390
+ 00:04:55.600 --> 00:04:59.919
391
+ feedback and finally if it comes across
392
+
393
+ 00:04:57.759 --> 00:05:01.919
394
+ any other image of a dog it will be able
395
+
396
+ 00:04:59.919 --> 00:05:03.840
397
+ to classify it correctly that is
398
+
399
+ 00:05:01.919 --> 00:05:05.520
400
+ reinforcement learning to generalize
401
+
402
+ 00:05:03.840 --> 00:05:07.680
403
+ machine learning model let's see a
404
+
405
+ 00:05:05.520 --> 00:05:09.280
406
+ flowchart input is given to a machine
407
+
408
+ 00:05:07.680 --> 00:05:10.960
409
+ learning model which then gives the
410
+
411
+ 00:05:09.280 --> 00:05:13.520
412
+ output according to the algorithm
413
+
414
+ 00:05:10.960 --> 00:05:16.000
415
+ applied if it's right we take the output
416
+
417
+ 00:05:13.520 --> 00:05:18.080
418
+ as a final result else we provide
419
+
420
+ 00:05:16.000 --> 00:05:20.639
421
+ feedback to the training model and ask
422
+
423
+ 00:05:18.080 --> 00:05:22.160
424
+ it to predict until it learns i hope
425
+
426
+ 00:05:20.639 --> 00:05:23.919
427
+ you've understood supervised and
428
+
429
+ 00:05:22.160 --> 00:05:26.240
430
+ unsupervised learning so let's have a
431
+
432
+ 00:05:23.919 --> 00:05:28.720
433
+ quick quiz you have to determine whether
434
+
435
+ 00:05:26.240 --> 00:05:30.560
436
+ the given scenarios uses supervised or
437
+
438
+ 00:05:28.720 --> 00:05:32.880
439
+ unsupervised learning simple right
440
+
441
+ 00:05:30.560 --> 00:05:35.039
442
+ scenario one facebook recognizes your
443
+
444
+ 00:05:32.880 --> 00:05:37.520
445
+ friend in a picture from an album of
446
+
447
+ 00:05:35.039 --> 00:05:40.639
448
+ tagged photographs
449
+
450
+ 00:05:37.520 --> 00:05:43.840
451
+ scenario 2 netflix recommends new movies
452
+
453
+ 00:05:40.639 --> 00:05:46.400
454
+ based on someone's past movie choices
455
+
456
+ 00:05:43.840 --> 00:05:48.800
457
+ scenario 3 analyzing bank data for
458
+
459
+ 00:05:46.400 --> 00:05:51.120
460
+ suspicious transactions and flagging the
461
+
462
+ 00:05:48.800 --> 00:05:53.360
463
+ fraud transactions think wisely and
464
+
465
+ 00:05:51.120 --> 00:05:55.440
466
+ comment below your answers moving on
467
+
468
+ 00:05:53.360 --> 00:05:57.680
469
+ don't you sometimes wonder how is
470
+
471
+ 00:05:55.440 --> 00:05:59.280
472
+ machine learning possible in today's era
473
+
474
+ 00:05:57.680 --> 00:06:02.000
475
+ well that's because today we have
476
+
477
+ 00:05:59.280 --> 00:06:04.479
478
+ humongous data available everybody is
479
+
480
+ 00:06:02.000 --> 00:06:06.240
481
+ online either making a transaction or
482
+
483
+ 00:06:04.479 --> 00:06:08.560
484
+ just surfing the internet and that's
485
+
486
+ 00:06:06.240 --> 00:06:10.960
487
+ generating a huge amount of data every
488
+
489
+ 00:06:08.560 --> 00:06:13.440
490
+ minute and that data my friend is the
491
+
492
+ 00:06:10.960 --> 00:06:15.520
493
+ key to analysis also the memory handling
494
+
495
+ 00:06:13.440 --> 00:06:17.360
496
+ capabilities of computers have largely
497
+
498
+ 00:06:15.520 --> 00:06:20.479
499
+ increased which helps them to process
500
+
501
+ 00:06:17.360 --> 00:06:23.280
502
+ such huge amount of data at hand without
503
+
504
+ 00:06:20.479 --> 00:06:25.360
505
+ any delay and yes computers now have
506
+
507
+ 00:06:23.280 --> 00:06:27.280
508
+ great computational powers so there are
509
+
510
+ 00:06:25.360 --> 00:06:29.520
511
+ a lot of applications of machine
512
+
513
+ 00:06:27.280 --> 00:06:31.280
514
+ learning out there to name a few machine
515
+
516
+ 00:06:29.520 --> 00:06:33.440
517
+ learning is used in healthcare where
518
+
519
+ 00:06:31.280 --> 00:06:35.440
520
+ diagnostics are predicted for doctor's
521
+
522
+ 00:06:33.440 --> 00:06:37.759
523
+ review the sentiment analysis that the
524
+
525
+ 00:06:35.440 --> 00:06:39.600
526
+ tech giants are doing on social media is
527
+
528
+ 00:06:37.759 --> 00:06:41.360
529
+ another interesting application of
530
+
531
+ 00:06:39.600 --> 00:06:43.280
532
+ machine learning fraud detection in the
533
+
534
+ 00:06:41.360 --> 00:06:45.520
535
+ finance sector and also to predict
536
+
537
+ 00:06:43.280 --> 00:06:47.120
538
+ customer churn in the e-commerce sector
539
+
540
+ 00:06:45.520 --> 00:06:49.759
541
+ while booking a gap you must have
542
+
543
+ 00:06:47.120 --> 00:06:51.520
544
+ encountered surge pricing often where it
545
+
546
+ 00:06:49.759 --> 00:06:54.240
547
+ says the fair of your trip has been
548
+
549
+ 00:06:51.520 --> 00:06:56.000
550
+ updated continue booking yes please i'm
551
+
552
+ 00:06:54.240 --> 00:06:58.160
553
+ getting late for office
554
+
555
+ 00:06:56.000 --> 00:07:00.240
556
+ well that's an interesting machine
557
+
558
+ 00:06:58.160 --> 00:07:02.639
559
+ learning model which is used by global
560
+
561
+ 00:07:00.240 --> 00:07:04.639
562
+ taxi giant uber and others where they
563
+
564
+ 00:07:02.639 --> 00:07:06.560
565
+ have differential pricing in real time
566
+
567
+ 00:07:04.639 --> 00:07:10.000
568
+ based on demand the number of cars
569
+
570
+ 00:07:06.560 --> 00:07:12.560
571
+ available bad weather rush r etc so they
572
+
573
+ 00:07:10.000 --> 00:07:14.800
574
+ use the surge pricing model to ensure
575
+
576
+ 00:07:12.560 --> 00:07:17.280
577
+ that those who need a cab can get one
578
+
579
+ 00:07:14.800 --> 00:07:19.599
580
+ also it uses predictive modeling to
581
+
582
+ 00:07:17.280 --> 00:07:21.680
583
+ predict where the demand will be high
584
+
585
+ 00:07:19.599 --> 00:07:23.759
586
+ with the goal that drivers can take care
587
+
588
+ 00:07:21.680 --> 00:07:26.319
589
+ of the demand and search pricing can be
590
+
591
+ 00:07:23.759 --> 00:07:29.280
592
+ minimized great hey siri can you remind
593
+
594
+ 00:07:26.319 --> 00:07:30.400
595
+ me to book a cab at 6 pm today ok i'll
596
+
597
+ 00:07:29.280 --> 00:07:33.120
598
+ remind you
599
+
600
+ 00:07:30.400 --> 00:07:35.520
601
+ thanks no problem comment below some
602
+
603
+ 00:07:33.120 --> 00:07:37.360
604
+ interesting everyday examples around you
605
+
606
+ 00:07:35.520 --> 00:07:39.840
607
+ where machines are learning and doing
608
+
609
+ 00:07:37.360 --> 00:07:41.840
610
+ amazing jobs so that's all for machine
611
+
612
+ 00:07:39.840 --> 00:07:43.680
613
+ learning basics today from my site keep
614
+
615
+ 00:07:41.840 --> 00:07:48.199
616
+ watching this space for more interesting
617
+
618
+ 00:07:43.680 --> 00:07:48.199
619
+ videos until then happy learning
620
+
621
+
requirements.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ flask==3.0.3
2
+ gunicorn==21.2.0
3
+ faiss-cpu==1.7.4
4
+ sentence-transformers==2.7.0
5
+ transformers==4.44.2
6
+
7
+ --extra-index-url https://download.pytorch.org/whl/cu121
8
+ torch==2.3.1+cu121
9
+
10
+ nltk==3.9.1
11
+ spacy==3.7.5
12
+ deepsegment==2.5.1
13
+ pandas==2.2.2
14
+ scikit-learn==1.5.1
15
+ webvtt-py==0.4.6
16
+ markupsafe==2.1.5
17
+ rank-bm25==0.2.2
templates/index.html ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- Search page (index.html) — input, autocomplete, and theme toggle -->
2
+
3
+ <!DOCTYPE html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <title>Subtitle Search</title>
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <style>
11
+ :root{
12
+ --maxw: 720px;
13
+ --radius: 8px;
14
+ --blue: #0b5fff;
15
+ --blue-hover: #0848c9;
16
+ --border: #d0d7de;
17
+ }
18
+
19
+ body {
20
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
21
+ padding: 30px;
22
+ color: #222;
23
+ background: #fff;
24
+
25
+ display: flex;
26
+ flex-direction: column;
27
+ min-height: 100vh;
28
+ align-items: center;
29
+ padding-top: 22vh;
30
+ }
31
+ h1 { margin-bottom: 16px; color: #222; }
32
+
33
+ .search-wrap {
34
+ position: relative;
35
+ max-width: 600px;
36
+ width: 100%;
37
+ margin: 0 auto;
38
+ }
39
+
40
+ .search-row {
41
+ display: flex;
42
+ gap: 0;
43
+ align-items: stretch;
44
+ }
45
+
46
+ #queryInput {
47
+ flex: 1 1 auto;
48
+ min-width: 0;
49
+ height: 42px;
50
+ box-sizing: border-box;
51
+ padding: 10px 12px 10px 40px;
52
+ font-size: 16px;
53
+ border: 1px solid var(--border);
54
+ border-radius: var(--radius) 0 0 var(--radius);
55
+ background:
56
+ url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2399a3ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>")
57
+ no-repeat 12px center / 18px 18px #fff;
58
+ color: #111;
59
+ background-color: #fff;
60
+ }
61
+ #queryInput::placeholder { color: #6b7280; }
62
+ #queryInput:focus {
63
+ outline: none;
64
+ border-color: var(--blue);
65
+ box-shadow: 0 0 0 3px rgba(11,95,255,.15);
66
+ }
67
+
68
+ .search-btn {
69
+ height: 42px;
70
+ box-sizing: border-box;
71
+ line-height: 42px;
72
+ padding: 0 16px;
73
+ font-size: 15px;
74
+ font-weight: 600;
75
+ color: #fff;
76
+ background: var(--blue);
77
+ border: 1px solid var(--blue);
78
+ border-radius: 0 var(--radius) var(--radius) 0;
79
+ cursor: pointer;
80
+ flex: 0 0 auto;
81
+ }
82
+ .search-btn:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
83
+
84
+ #suggestions {
85
+ border: 1px solid #ccc;
86
+ border-radius: 6px;
87
+ max-width: var(--maxw);
88
+ margin-top: 6px;
89
+ padding: 0;
90
+ list-style: none;
91
+ background: #fff;
92
+ position: absolute;
93
+ top: calc(42px + 6px);
94
+ left: 0;
95
+ width: 100%;
96
+ z-index: 10;
97
+ display: none;
98
+ box-shadow: 0 8px 16px rgba(0,0,0,0.08);
99
+ overflow: hidden;
100
+ color: #111;
101
+ }
102
+ #suggestions.show { display: block; }
103
+
104
+ #suggestions li {
105
+ padding: 10px 12px;
106
+ cursor: pointer;
107
+ line-height: 1.3;
108
+ }
109
+ #suggestions li:hover,
110
+ #suggestions li.selected { background: #f0f6ff; }
111
+ .no-suggestions {
112
+ color: #666;
113
+ font-style: italic;
114
+ padding: 10px 12px;
115
+ }
116
+
117
+ #loading {
118
+ font-size: 14px;
119
+ color: #666;
120
+ margin-top: 6px;
121
+ display: none;
122
+ }
123
+
124
+ body, #queryInput, #suggestions, .search-btn, .theme-toggle {
125
+ transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s;
126
+ }
127
+
128
+ .theme-toggle {
129
+ position: fixed; top: 16px; right: 16px;
130
+ background: #f9f9f9; color: #222;
131
+ border: 1px solid #00000022; padding: 8px 12px; border-radius: 8px;
132
+ font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
133
+ }
134
+ .theme-toggle:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.15); }
135
+
136
+ html[data-theme="dark"] body { background: #0e0f12; color: #e7e9ee; }
137
+ html[data-theme="dark"] h1 { color: #e7e9ee; }
138
+
139
+ html[data-theme="dark"] #queryInput {
140
+ background-color: #15171c;
141
+ color: #e7e9ee;
142
+ border-color: #333;
143
+ }
144
+ html[data-theme="dark"] #queryInput::placeholder { color: #b3b8c4; }
145
+
146
+ html[data-theme="dark"] #suggestions {
147
+ background: #15171c;
148
+ color: #e7e9ee;
149
+ border-color: #333;
150
+ box-shadow: 0 8px 16px rgba(0,0,0,0.4);
151
+ }
152
+ html[data-theme="dark"] #suggestions li { color: #e7e9ee; }
153
+ html[data-theme="dark"] #suggestions li:hover,
154
+ html[data-theme="dark"] li.selected { background: #1d2026; }
155
+ html[data-theme="dark"] .no-suggestions { color: #b3b8c4; }
156
+
157
+ html[data-theme="dark"] #loading { color: #b3b8c4; }
158
+
159
+ html[data-theme="dark"] .search-btn {
160
+ background: #2d7ed8;
161
+ border-color: #2d7ed8;
162
+ color: #fff;
163
+ }
164
+ html[data-theme="dark"] .search-btn:hover {
165
+ background: #2464ac;
166
+ border-color: #2464ac;
167
+ }
168
+
169
+ html[data-theme="dark"] .theme-toggle {
170
+ background: #15171c; color: #e7e9ee; border-color: #333;
171
+ box-shadow: 0 4px 12px rgba(0,0,0,0.4);
172
+ }
173
+ </style>
174
+ </head>
175
+ <body>
176
+ <!-- Theme toggle -->
177
+ <button id="themeToggle" class="theme-toggle" onclick="__toggleTheme()">🌙 Dark</button>
178
+
179
+ <h1>Keyword Search</h1>
180
+
181
+ <!-- Search form with autocomplete -->
182
+ <form action="/search" method="POST" autocomplete="off" role="search" class="search-wrap">
183
+ <div class="search-row">
184
+ <input
185
+ type="text"
186
+ name="query"
187
+ id="queryInput"
188
+ placeholder="Enter your query here (e.g., neural networks)"
189
+ size="50"
190
+ aria-label="Search input"
191
+ aria-autocomplete="list"
192
+ aria-controls="suggestions"
193
+ aria-expanded="false"
194
+ aria-haspopup="listbox">
195
+ <button type="submit" class="search-btn">Search</button>
196
+ </div>
197
+
198
+ <div id="loading" aria-live="polite">Loading suggestions…</div>
199
+ <ul id="suggestions" role="listbox" aria-labelledby="queryInput"></ul>
200
+ </form>
201
+
202
+ <!-- Version tag -->
203
+ <div style="font-size:0.8em; color:#888; margin-top:6px; text-align:center;">
204
+ Version 1.1
205
+ </div>
206
+
207
+ <!-- Theme toggle logic -->
208
+ <script>
209
+ (function() {
210
+ const saved = localStorage.getItem('theme');
211
+ if (saved) document.documentElement.dataset.theme = saved;
212
+
213
+ function setTheme(t) {
214
+ document.documentElement.dataset.theme = t;
215
+ localStorage.setItem('theme', t);
216
+ const btn = document.getElementById('themeToggle');
217
+ if (btn) btn.textContent = t === 'dark' ? ' Light' : ' Dark';
218
+ }
219
+
220
+ window.__toggleTheme = function() {
221
+ const next = (document.documentElement.dataset.theme === 'dark') ? 'light' : 'dark';
222
+ setTheme(next);
223
+ };
224
+
225
+ document.addEventListener('DOMContentLoaded', () => {
226
+ const cur = document.documentElement.dataset.theme || 'light';
227
+ const btn = document.getElementById('themeToggle');
228
+ if (btn) btn.textContent = cur === 'dark' ? ' Light' : ' Dark';
229
+ });
230
+ })();
231
+ </script>
232
+
233
+ <!-- Autocomplete logic -->
234
+ <script>
235
+ const input = document.getElementById('queryInput');
236
+ const suggestionBox = document.getElementById('suggestions');
237
+ const loadingEl = document.getElementById('loading');
238
+
239
+ const escapeHtml = (str) =>
240
+ str.replace(/[&<>"']/g, t => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[t]));
241
+
242
+ let selectedIndex = -1;
243
+
244
+ input.addEventListener('input', async () => {
245
+ const term = input.value.trim();
246
+ suggestionBox.classList.remove('show');
247
+ suggestionBox.innerHTML = '';
248
+ input.setAttribute('aria-expanded', 'false');
249
+ selectedIndex = -1;
250
+
251
+ if (term.length < 2) {
252
+ loadingEl.style.display = 'none';
253
+ return;
254
+ }
255
+
256
+ loadingEl.style.display = 'block';
257
+ try {
258
+ const res = await fetch(`/autocomplete?term=${encodeURIComponent(term)}`);
259
+ const suggestions = await res.json();
260
+ loadingEl.style.display = 'none';
261
+
262
+ if (!Array.isArray(suggestions) || suggestions.length === 0) {
263
+ suggestionBox.innerHTML = '<li class="no-suggestions" role="option" aria-disabled="true">No suggestions found</li>';
264
+ suggestionBox.classList.add('show');
265
+ input.setAttribute('aria-expanded', 'true');
266
+ return;
267
+ }
268
+
269
+ suggestionBox.innerHTML = suggestions
270
+ .map(s => `<li role="option">${escapeHtml(s)}</li>`)
271
+ .join('');
272
+ suggestionBox.classList.add('show');
273
+ input.setAttribute('aria-expanded', 'true');
274
+
275
+ } catch (err) {
276
+ console.error('Autocomplete error:', err);
277
+ loadingEl.style.display = 'none';
278
+ }
279
+ });
280
+
281
+ suggestionBox.addEventListener('click', (e) => {
282
+ const li = e.target.closest('li[role="option"]');
283
+ if (!li || li.classList.contains('no-suggestions')) return;
284
+ input.value = li.textContent;
285
+ suggestionBox.classList.remove('show');
286
+ suggestionBox.innerHTML = '';
287
+ input.setAttribute('aria-expanded', 'false');
288
+ });
289
+
290
+ input.addEventListener('keydown', (e) => {
291
+ const items = suggestionBox.querySelectorAll('li[role="option"]:not(.no-suggestions)');
292
+ if (!items.length) return;
293
+
294
+ if (e.key === 'ArrowDown') {
295
+ e.preventDefault();
296
+ selectedIndex = Math.min(selectedIndex + 1, items.length - 1);
297
+ updateSelection(items);
298
+ } else if (e.key === 'ArrowUp') {
299
+ e.preventDefault();
300
+ selectedIndex = Math.max(selectedIndex - 1, 0);
301
+ updateSelection(items);
302
+ } else if (e.key === 'Enter') {
303
+ if (selectedIndex >= 0) {
304
+ e.preventDefault();
305
+ input.value = items[selectedIndex].textContent;
306
+ suggestionBox.classList.remove('show');
307
+ suggestionBox.innerHTML = '';
308
+ input.setAttribute('aria-expanded', 'false');
309
+ }
310
+ } else if (e.key === 'Escape') {
311
+ suggestionBox.classList.remove('show');
312
+ suggestionBox.innerHTML = '';
313
+ input.setAttribute('aria-expanded', 'false');
314
+ }
315
+ });
316
+
317
+ function updateSelection(items) {
318
+ items.forEach((item, i) => item.classList.toggle('selected', i === selectedIndex));
319
+ const active = items[selectedIndex];
320
+ if (active) active.scrollIntoView({ block: 'nearest' });
321
+ }
322
+
323
+ document.addEventListener('click', (e) => {
324
+ if (!e.target.closest('form')) {
325
+ suggestionBox.classList.remove('show');
326
+ suggestionBox.innerHTML = '';
327
+ input.setAttribute('aria-expanded', 'false');
328
+ }
329
+ });
330
+ </script>
331
+ </body>
332
+ </html>
templates/results.html ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- Results page (results.html) — shows search results with semantic toggle, autocomplete, and pagination -->
2
+
3
+ <!DOCTYPE html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <title>Search Results</title>
8
+ <link rel="preconnect" href="https://www.youtube.com">
9
+ <link rel="preconnect" href="https://img.youtube.com">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1">
11
+
12
+ <!-- Theme bootstrap -->
13
+ <script>
14
+ try {
15
+ var t = localStorage.getItem('theme');
16
+ if (t) { document.documentElement.dataset.theme = t; }
17
+ } catch (e) {}
18
+ </script>
19
+
20
+ <style>
21
+ :root {
22
+ --bg: #ffffff;
23
+ --bg-soft: #f9f9f9;
24
+ --text: #222;
25
+ --text-muted: #555;
26
+ --accent: #007bff;
27
+ --accent-dark: #0056b3;
28
+ --good: #28a745;
29
+ --good-dark: #218838;
30
+ --warn-bg: #fff3cd;
31
+ --warn-text: #856404;
32
+ --warn-accent: #ffc107;
33
+ --shadow: rgba(0,0,0,0.08);
34
+ --shadow-strong: rgba(0,0,0,0.15);
35
+ --border: #eee;
36
+ }
37
+
38
+ html[data-theme="dark"] {
39
+ --bg: #0e0f12;
40
+ --bg-soft: #15171c;
41
+ --text: #e7e9ee;
42
+ --text-muted: #b3b8c4;
43
+ --accent: #4ea1ff;
44
+ --accent-dark: #2d7ed8;
45
+ --good: #39d353;
46
+ --good-dark: #29943a;
47
+ --warn-bg: #2a2206;
48
+ --warn-text: #f0d08a;
49
+ --warn-accent: #ffd15a;
50
+ --shadow: rgba(0,0,0,0.4);
51
+ --shadow-strong: rgba(0,0,0,0.6);
52
+ --border: #333;
53
+ }
54
+
55
+ * { box-sizing: border-box; }
56
+ body {
57
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
58
+ padding: 30px;
59
+ background: linear-gradient(to bottom right, #f3f4f6, #ffffff);
60
+ color: var(--text);
61
+ }
62
+
63
+ body, .result-card, .context-block { transition: background-color .2s, color .2s, box-shadow .2s; }
64
+ html[data-theme="dark"] body { background: #0e0f12; }
65
+
66
+ h1 { color: var(--text); margin-bottom: 10px; }
67
+
68
+ /* Search bar */
69
+ .search-wrap {
70
+ position: relative;
71
+ max-width: 600px;
72
+ width: 100%;
73
+ margin: 0 auto 20px auto;
74
+ }
75
+ .search-row {
76
+ display: flex;
77
+ gap: 0;
78
+ align-items: stretch;
79
+ }
80
+ #queryInput {
81
+ flex: 1 1 auto;
82
+ min-width: 0;
83
+ height: 42px;
84
+ box-sizing: border-box;
85
+ padding: 10px 12px 10px 40px;
86
+ font-size: 16px;
87
+ border: 1px solid var(--border);
88
+ border-radius: 8px 0 0 8px;
89
+ background:
90
+ url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2399a3ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>")
91
+ no-repeat 12px center / 18px 18px #fff;
92
+ color: #111;
93
+ background-color: #fff;
94
+ }
95
+ #queryInput::placeholder { color: #6b7280; }
96
+ .search-btn {
97
+ height: 42px;
98
+ padding: 0 16px;
99
+ font-size: 15px;
100
+ font-weight: 600;
101
+ color: #fff;
102
+ background: var(--accent);
103
+ border: 1px solid var(--accent);
104
+ border-radius: 0 8px 8px 0;
105
+ cursor: pointer;
106
+ flex: 0 0 auto;
107
+ }
108
+ .search-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
109
+
110
+ /* Autocomplete dropdown */
111
+ #loading {
112
+ font-size: 14px;
113
+ color: #666;
114
+ margin-top: 6px;
115
+ display: none;
116
+ }
117
+ #suggestions {
118
+ border: 1px solid #ccc;
119
+ border-radius: 6px;
120
+ max-width: 600px;
121
+ margin-top: 6px;
122
+ padding: 0;
123
+ list-style: none;
124
+ background: #fff;
125
+ position: absolute;
126
+ top: calc(42px + 6px);
127
+ left: 0;
128
+ width: 100%;
129
+ z-index: 10;
130
+ display: none;
131
+ box-shadow: 0 8px 16px rgba(0,0,0,0.08);
132
+ overflow: hidden;
133
+ color: #111;
134
+ }
135
+ #suggestions.show { display: block; }
136
+ #suggestions li {
137
+ padding: 10px 12px;
138
+ cursor: pointer;
139
+ line-height: 1.3;
140
+ }
141
+ #suggestions li:hover,
142
+ #suggestions li.selected { background: #f0f6ff; }
143
+ .no-suggestions {
144
+ color: #666;
145
+ font-style: italic;
146
+ padding: 10px 12px;
147
+ }
148
+
149
+ /* Dark theme overrides */
150
+ html[data-theme="dark"] #queryInput {
151
+ background-color: #15171c;
152
+ color: #e7e9ee;
153
+ border-color: #333;
154
+ }
155
+ html[data-theme="dark"] #queryInput::placeholder { color: #b3b8c4; }
156
+ html[data-theme="dark"] .search-btn {
157
+ background: #2d7ed8; border-color: #2d7ed8; color: #fff;
158
+ }
159
+ html[data-theme="dark"] .search-btn:hover {
160
+ background: #2464ac; border-color: #2464ac;
161
+ }
162
+ html[data-theme="dark"] #suggestions {
163
+ background: #15171c;
164
+ color: #e7e9ee;
165
+ border-color: #333;
166
+ box-shadow: 0 8px 16px rgba(0,0,0,0.4);
167
+ }
168
+ html[data-theme="dark"] #suggestions li { color: #e7e9ee; }
169
+ html[data-theme="dark"] #suggestions li:hover,
170
+ html[data-theme="dark"] #suggestions li.selected { background: #1d2026; }
171
+ html[data-theme="dark"] .no-suggestions { color: var(--text-muted); }
172
+ html[data-theme="dark"] #loading { color: var(--text-muted); }
173
+
174
+ .meta-count { margin-bottom: 24px; color: #333; }
175
+ html[data-theme="dark"] .meta-count { color: var(--text); }
176
+
177
+ /* Result cards */
178
+ .result-card {
179
+ background: var(--bg);
180
+ border-radius: 12px;
181
+ box-shadow: 0 4px 12px var(--shadow);
182
+ padding: 20px;
183
+ margin-bottom: 30px;
184
+ transition: 0.25s ease;
185
+ }
186
+ .result-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px var(--shadow-strong); }
187
+
188
+ .video-title { font-size: 20px; font-weight: 700; color: #333; margin-bottom: 6px; line-height: 1.25; word-break: break-word; }
189
+ html[data-theme="dark"] .video-title { color: var(--text); }
190
+
191
+ .timestamp { font-size: 14px; color: #666; margin-bottom: 8px; }
192
+ html[data-theme="dark"] .timestamp { color: var(--text-muted); }
193
+
194
+ .thumb-wrap { margin: 10px 0 6px; }
195
+ .thumbnail { width: 320px; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }
196
+
197
+ .jump-link {
198
+ display: inline-block;
199
+ margin-top: 8px;
200
+ padding: 10px 16px;
201
+ background-color: var(--accent);
202
+ color: #fff;
203
+ text-decoration: none;
204
+ border-radius: 6px;
205
+ font-weight: 600;
206
+ }
207
+ .jump-link:hover { background-color: var(--accent-dark); }
208
+
209
+ .context-block {
210
+ background: var(--bg-soft);
211
+ border-left: 4px solid var(--accent);
212
+ padding: 12px;
213
+ margin-top: 14px;
214
+ white-space: pre-wrap;
215
+ font-size: 15px;
216
+ line-height: 1.5;
217
+ word-wrap: break-word;
218
+ }
219
+
220
+ .summary { font-style: italic; margin-top: 10px; color: var(--text-muted); word-wrap: break-word; }
221
+
222
+ mark { background-color: #fff59e; padding: 0 2px; border-radius: 2px; }
223
+
224
+ /* Pagination */
225
+ .show-more-form { text-align: center; margin-top: 30px; }
226
+ .show-more-form button {
227
+ padding: 12px 20px;
228
+ font-size: 16px;
229
+ background-color: var(--good);
230
+ color: white;
231
+ border: none;
232
+ border-radius: 6px;
233
+ cursor: pointer;
234
+ font-weight: 600;
235
+ }
236
+ .show-more-form button:hover { background-color: var(--good-dark); }
237
+
238
+ /* 💡 Did you mean? suggestion */
239
+ .suggestion-box {
240
+ background: var(--warn-bg);
241
+ border-left: 4px solid var(--warn-accent);
242
+ padding: 12px 20px;
243
+ margin-bottom: 20px;
244
+ font-size: 15px;
245
+ color: var(--warn-text);
246
+ }
247
+ .suggestion-box form { display: inline; }
248
+ .suggestion-box button {
249
+ background: none;
250
+ border: none;
251
+ color: var(--accent);
252
+ font-weight: 700;
253
+ text-decoration: underline;
254
+ cursor: pointer;
255
+ padding: 0;
256
+ font-size: 15px;
257
+ }
258
+ .suggestion-box button:hover { color: var(--accent-dark); }
259
+
260
+ /* Theme toggle button */
261
+ .theme-toggle {
262
+ position: fixed; top: 16px; right: 16px;
263
+ background: var(--bg-soft); color: var(--text);
264
+ border: 1px solid #00000022; padding: 8px 12px; border-radius: 8px;
265
+ font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px var(--shadow);
266
+ }
267
+ .theme-toggle:hover { box-shadow: 0 6px 18px var(--shadow-strong); }
268
+
269
+ /* ✅Semantic toggle button */
270
+ .semantic-btn {
271
+ padding: 6px 12px;
272
+ border-radius: 8px;
273
+ border: 1px solid var(--border);
274
+ background: var(--bg-soft);
275
+ color: var(--text);
276
+ cursor: pointer;
277
+ font-size: 14px;
278
+ font-weight: 600;
279
+ transition: background-color 0.2s, color 0.2s, border-color 0.2s;
280
+ }
281
+ .semantic-btn.active {
282
+ background: var(--accent);
283
+ color: #fff;
284
+ border-color: var(--accent);
285
+ }
286
+ html[data-theme="dark"] .semantic-btn {
287
+ background: var(--bg-soft);
288
+ color: var(--text);
289
+ border-color: var(--border);
290
+ }
291
+ html[data-theme="dark"] .semantic-btn.active {
292
+ background: var(--accent);
293
+ color: #fff;
294
+ border-color: var(--accent);
295
+ }
296
+ </style>
297
+
298
+ <!-- Theme toggle logic -->
299
+ <script>
300
+ (function() {
301
+ const saved = localStorage.getItem('theme');
302
+ if (saved) document.documentElement.dataset.theme = saved;
303
+ function setTheme(t) {
304
+ document.documentElement.dataset.theme = t;
305
+ localStorage.setItem('theme', t);
306
+ const btn = document.getElementById('themeToggle');
307
+ if (btn) btn.textContent = t === 'dark' ? ' Light' : ' Dark';
308
+ }
309
+ window.__toggleTheme = function() {
310
+ const next = (document.documentElement.dataset.theme === 'dark') ? 'light' : 'dark';
311
+ setTheme(next);
312
+ };
313
+ document.addEventListener('DOMContentLoaded', () => {
314
+ const cur = document.documentElement.dataset.theme || 'light';
315
+ const btn = document.getElementById('themeToggle');
316
+ if (btn) btn.textContent = cur === 'dark' ? ' Light' : ' Dark';
317
+ });
318
+ })();
319
+ </script>
320
+ </head>
321
+ <body>
322
+ <button id="themeToggle" class="theme-toggle" onclick="__toggleTheme()"> Dark</button>
323
+
324
+ <!-- 🔎 Search bar at top -->
325
+ <form action="/search" method="POST" autocomplete="off" role="search" class="search-wrap">
326
+ <div class="search-row">
327
+ <input
328
+ type="text"
329
+ name="query"
330
+ id="queryInput"
331
+ placeholder="Enter your query here (e.g., neural networks)"
332
+ size="50"
333
+ value="{{ query }}"
334
+ aria-label="Search input"
335
+ aria-autocomplete="list"
336
+ aria-controls="suggestions"
337
+ aria-expanded="false"
338
+ aria-haspopup="listbox">
339
+ <button type="submit" class="search-btn">Search</button>
340
+ </div>
341
+ <div id="loading" aria-live="polite">Loading suggestions…</div>
342
+ <ul id="suggestions" role="listbox" aria-labelledby="queryInput"></ul>
343
+ </form>
344
+
345
+ <h1>🔍 Search Results for: “{{ query }}”</h1>
346
+
347
+ <p class="meta-count">
348
+ <strong>Showing {{ shown }} of {{ total_matches }} results.</strong>
349
+ <!-- Semantic toggle button -->
350
+ <form method="POST" action="/search" style="display:inline; margin-left:10px;">
351
+ <input type="hidden" name="query" value="{{ query }}">
352
+ <input type="hidden" name="start" value="0">
353
+ <input type="hidden" name="shown" value="0">
354
+ <input type="hidden" name="previous_results" value="[]">
355
+ <button type="submit"
356
+ name="semantic"
357
+ value="{% if semantic %}false{% else %}true{% endif %}"
358
+ class="semantic-btn {% if semantic %}active{% endif %}">
359
+ Semantic: {% if semantic %}ON{% else %}OFF{% endif %}
360
+ </button>
361
+ </form>
362
+ {% if semantic %}
363
+ <span class="semantic-note">
364
+ Semantic mode may return results without the exact words but with similar meaning.
365
+ </span>
366
+ {% endif %}
367
+ </p>
368
+
369
+ <!-- Did you mean? -->
370
+ {% if suggestion_term %}
371
+ <div class="suggestion-box" role="note" aria-live="polite">
372
+ 💡 Looking for
373
+ <form method="POST" action="/search">
374
+ <input type="hidden" name="query" value="{{ suggestion_term }}">
375
+ <input type="hidden" name="shown" value="0">
376
+ <input type="hidden" name="start" value="0">
377
+ <input type="hidden" name="previous_results" value="[]">
378
+ {% if semantic %}
379
+ <input type="hidden" name="semantic" value="true">
380
+ {% endif %}
381
+ <button type="submit">“{{ suggestion_term }}”</button>
382
+ </form>?
383
+ Try searching that too!
384
+ </div>
385
+ {% endif %}
386
+
387
+ <!-- Results loop -->
388
+ {% for result in results %}
389
+ <div class="result-card">
390
+ <div class="video-title">{{ result.video_title }}</div>
391
+ {% if result.video_id and result.video_id != 'unknown' %}
392
+ <div class="thumb-wrap">
393
+ <img
394
+ class="thumbnail"
395
+ loading="lazy"
396
+ src="https://img.youtube.com/vi/{{ result.video_id }}/hqdefault.jpg"
397
+ alt="Thumbnail for {{ result.video_title }}"
398
+ onerror="this.onerror=null;this.src='https://via.placeholder.com/320x180?text=Thumbnail+Not+Available';">
399
+ </div>
400
+ <div class="timestamp">
401
+ ⏱️ <time datetime="{{ result.timestamp }}">{{ result.timestamp }}</time>
402
+ </div>
403
+ <a
404
+ class="jump-link"
405
+ href="https://www.youtube.com/watch?v={{ result.video_id }}&t={{ result.timestamp|jump_time }}s"
406
+ target="_blank"
407
+ rel="noopener">▶ Jump to Video</a>
408
+ {% else %}
409
+ <div style="color:#b00020;">⚠️ No video ID found. Cannot jump to video.</div>
410
+ {% endif %}
411
+ <div class="context-block">{{ result.highlighted_block }}</div>
412
+ <div class="summary"> Summary: {{ result.summary }}</div>
413
+ </div>
414
+ {% endfor %}
415
+
416
+ <!-- Pagination -->
417
+ {% if start < total_matches %}
418
+ <div class="show-more-form">
419
+ <form method="POST" action="/search">
420
+ <input type="hidden" name="query" value="{{ query }}">
421
+ <input type="hidden" name="start" value="{{ start }}">
422
+ <input type="hidden" name="shown" value="{{ shown }}">
423
+ <input type="hidden" name="previous_results" value='{{ previous_results | tojson | safe }}'>
424
+ {% if semantic %}
425
+ <input type="hidden" name="semantic" value="true">
426
+ {% endif %}
427
+ <button type="submit"> Show More Results</button>
428
+ </form>
429
+ </div>
430
+ {% endif %}
431
+
432
+ <br>
433
+ <a href="/">← Back to Search</a>
434
+ </body>
435
+ </html>