YouTube2Text

AI in Business and Finance — Transcript

by Mohamed Watfa · 10,193 words · 1,558 segments · language en · Watch on YouTube

Full transcript

  1. 0:02Okay, welcome back guys. So, today's
  2. 0:04lecture is about AI in business and
  3. 0:07finance. So, we've talked about AI in
  4. 0:10healthcare, we talked about AI in
  5. 0:12education,
  6. 0:13we talked about AI in creative
  7. 0:16expressions,
  8. 0:17poetry, music. So, today we're going to
  9. 0:20talk about AI in business and finance,
  10. 0:21which is also a very interesting topic.
  11. 0:23I we wanted to kind of
  12. 0:25explore the potentials of AI in
  13. 0:28different disciplines and not only is
  14. 0:30maybe give you some concrete examples of
  15. 0:32real applications, real algorithms. One
  16. 0:35more time, I'm going to reiterate, when
  17. 0:38we talk about AI, we want to talk about
  18. 0:40AI, the engine behind AI. Not like AI is
  19. 0:44used to generate predictions. We need to
  20. 0:47know what algorithm was used. How was it
  21. 0:49used? Again, this is why the future
  22. 0:53depends on experts in business. I'm not
  23. 0:57an expert in business, but experts in
  24. 0:59business will know how to use AI. Who
  25. 1:01knows know the details and the
  26. 1:03technicalities behind it, okay? Let's go
  27. 1:06through this. So, AI in business and
  28. 1:08finance is the topic.
  29. 1:11Let's start. So, again, AI generated on
  30. 1:13purpose. I do these just to give us a
  31. 1:16nutshell of using AI to teach AI, okay?
  32. 1:19So, yes, AI in business, yes.
  33. 1:22One, we could look at trading, look at
  34. 1:25chatbots like we did with healthcare,
  35. 1:28fraud detection. So, we're going to talk
  36. 1:30about the details now. Credit scoring,
  37. 1:34banking,
  38. 1:36loans, loan defaults, meaning they don't
  39. 1:39pay their loans, investment management.
  40. 1:42This is a huge thing. I think I've I've
  41. 1:44mentioned this before. I do have one of
  42. 1:46my friends who work in business and
  43. 1:48finance. His background is computer
  44. 1:49engineering. Super smart, super genius
  45. 1:52friend.
  46. 1:53He did a bachelor's in computer
  47. 1:55engineering again from one of the top
  48. 1:58universities. He went and did a master's
  49. 1:59in computer engineering, again, a top A
  50. 2:02student, GPA 4. Uh super smart. All of a
  51. 2:05sudden, he said, "You know what? I don't
  52. 2:07think computer engineering is for me."
  53. 2:08I'm like, "What? You You're a genius in
  54. 2:09computers."
  55. 2:11He went to finance. He went to basically
  56. 2:13investments,
  57. 2:15uh stocks analysis. He uses background
  58. 2:18in computers to make recommendations,
  59. 2:21and again, makes multi-million dollars a
  60. 2:23year. So, this is a very good example I
  61. 2:25use
  62. 2:27um to to show the potentials of having a
  63. 2:30technological background and
  64. 2:32implementing it in different domains is
  65. 2:35really uh
  66. 2:36uh it pays off. It pays off big time,
  67. 2:38okay? So, let's go over this.
  68. 2:40Uh what would we learn in this lecture?
  69. 2:42Um
  70. 2:43Again, there's a learning objectives,
  71. 2:45learning outcomes.
  72. 2:46Hopefully, you're going to identify some
  73. 2:48key applications of AI in business and
  74. 2:51finance.
  75. 2:52Understand how AI models are used for
  76. 2:55prediction and decision-making. That's
  77. 2:58very important. We can look at some
  78. 3:00examples, financial data and finance
  79. 3:03using some AI concept. Let me give you
  80. 3:05some small
  81. 3:06uh
  82. 3:07worked example, maybe with numbers.
  83. 3:10Again, one word, I don't want to go too
  84. 3:11technical because this is not a
  85. 3:13technical course as per se, but still we
  86. 3:16need to quantify. Like we did in
  87. 3:18healthcare, we looked at accuracy,
  88. 3:20precision, recall.
  89. 3:22These measures that really are core of
  90. 3:25you identifying how good is an AI system
  91. 3:29doing, okay? So, we're going to do some
  92. 3:31examples also in business and finance.
  93. 3:33Evaluating risk, some ethical
  94. 3:35implications of AI. Obviously,
  95. 3:37everywhere we deploy AI, we ask the
  96. 3:39multi-million dollar question. You know,
  97. 3:41how ethical it is. Can I do this? You
  98. 3:43know, if I can, what are the
  99. 3:45limitations? So, these are questions to
  100. 3:47ask. Again, we're going to revisit the
  101. 3:48confusion matrix that I've talked about
  102. 3:51in healthcare. Again, you can apply it
  103. 3:52in any domain, but I'll apply it also in
  104. 3:55the business domain with some worked
  105. 3:57examples. So, let's start with the
  106. 3:58obvious question. Why?
  107. 4:00Why AI in business? Why can't we do
  108. 4:02things the way they are done? Why
  109. 4:04involve AI? And how how it would help.
  110. 4:09So, obviously the the the first answer
  111. 4:11to this is because of the data. We have
  112. 4:13massive amount of data. Like everywhere
  113. 4:16else in business, it's even more. Again,
  114. 4:18if I want to add marketing to the mix of
  115. 4:20business, finance, and marketing, so
  116. 4:22basically a school of business,
  117. 4:24um you would see that data is all over.
  118. 4:26So, we have transactions, financial
  119. 4:28transactions. People are buying using
  120. 4:30their credit cards left and right all
  121. 4:32over. Especially these days with, you
  122. 4:35know, digital currency and also digital
  123. 4:37transactions. Nobody carries a credit
  124. 4:39card anymore. We do it with our phones.
  125. 4:42So, e-payments, m-payments, mobile
  126. 4:44payments, and so on
  127. 4:46are very common. So, we have a lot of
  128. 4:47data, a lot of transactions happening.
  129. 4:49Customer behavior. So, how are customers
  130. 4:52behaving? Could be some simple things,
  131. 4:55buying, selling, you know, consumers
  132. 4:57could they're consuming
  133. 4:59um going to restaurants. And all these
  134. 5:01behavior, how they're When do they buy,
  135. 5:04you know, during summer, during this
  136. 5:06time, and all these. Market data, of
  137. 5:08course, how's the market fluctuating.
  138. 5:11So, we have a lot of data. So,
  139. 5:13AI will obviously help us understand
  140. 5:15these data more, making better
  141. 5:17decisions, automating some of these
  142. 5:20processes. Again, from different ends,
  143. 5:22could be at the consumer end or from the
  144. 5:24supplier end or from the big companies
  145. 5:26end.
  146. 5:27Um
  147. 5:29Again, hopefully reducing risks,
  148. 5:31optimizing profit. All these are
  149. 5:34measurements in the business world. You
  150. 5:36know, we want to maximize profit. Who
  151. 5:38doesn't? We want to minimize cost. So,
  152. 5:40most of the things we do in the business
  153. 5:41world, if you're coming from a business
  154. 5:43major or finance, has to do with
  155. 5:46optimization. We're optimizing something
  156. 5:48and subject to specific constraints.
  157. 5:51Usually we used to model it, we could
  158. 5:52simulate it on a computer. Now with AI
  159. 5:55we could even do better, we could
  160. 5:57automate this and we could do some
  161. 5:59reinforcement learning where we're
  162. 6:01learning as we go all over time. This is
  163. 6:04also very very interesting when it comes
  164. 6:07to almost any applications of AI. Okay,
  165. 6:10so AI turns data into competitive
  166. 6:12advantage. I love this. I put it at the
  167. 6:14bottom.
  168. 6:16Really, now companies who really employ
  169. 6:18and deploy AI systems and agents, we've
  170. 6:22talked about agents before, in an
  171. 6:24efficient way to optimize their
  172. 6:26processes will have a competitive edge.
  173. 6:29And this is really going to be the game
  174. 6:31that companies not going to be, I think
  175. 6:33it's already uh the game uh for for
  176. 6:36competition. So if you want to kick out
  177. 6:38your competition, have a better AI
  178. 6:39agent, have better optimizations,
  179. 6:42therefore having a better
  180. 6:45uh competitive edge, you know? This is
  181. 6:47very important. I mean, I was reading
  182. 6:49the other day, I was just recently, one
  183. 6:51of the articles that came out is how
  184. 6:53they were able
  185. 6:55the the
  186. 6:56um authors from Google, they published a
  187. 6:59compression technique uh for GPTs
  188. 7:03that can compress almost seven times
  189. 7:06better than what we have today.
  190. 7:08Again, for those who don't know
  191. 7:09technicalities a lot. So when you are
  192. 7:11typing and chatting with ChatGPT for you
  193. 7:13to understand, ideally
  194. 7:16uh what you're typing is saved in a
  195. 7:18cache. A specific kind of cache, I'm not
  196. 7:20going to go through the technicals.
  197. 7:22And obviously as you type more, the
  198. 7:23cache will grow more, this cache memory.
  199. 7:26So if I have a way to compress, I could
  200. 7:29literally make my system faster by
  201. 7:33getting even less memory space. Less
  202. 7:36memory meaning let more better
  203. 7:38searching, hence I could do it in a
  204. 7:40better way. And imagine if I have that
  205. 7:44algorithm. Now, obviously Google has it.
  206. 7:46Um therefore, their GPT would be seven
  207. 7:49times faster what other GPTs are out
  208. 7:52there by using a specific algorithm. So,
  209. 7:54AI in this case gave them a competitive
  210. 7:56edge. Obviously, we will what what you
  211. 7:59can do in 7 minutes, I can do in 1
  212. 8:02minute. Imagine the comparison. By just
  213. 8:04designing a new algorithm. So, AI uh by
  214. 8:07by manipulating AI in in a in a better
  215. 8:10way, you can do better optimization.
  216. 8:13Okay. So, if you look at the pipeline,
  217. 8:15I've done this pipeline again before in
  218. 8:17healthcare. I've done it in creative
  219. 8:18science. I do it always in the
  220. 8:20applications. So, we always have the
  221. 8:21pipeline. I have this data coming in. We
  222. 8:23do some kind of pre-processing. Then we
  223. 8:26have a model hopefully. Then we deploy
  224. 8:28it. So, in the case of business, our
  225. 8:30data is all about sales, customer data.
  226. 8:32I've talked about this. Prices,
  227. 8:34behavior, all these. We do some
  228. 8:36pre-processing, cleaning them,
  229. 8:38normalizing them. I've talked about
  230. 8:39normalization before. Again, we want to
  231. 8:41normalize. We want to have the same
  232. 8:42denominator. Cuz I when I do
  233. 8:44comparisons, when I do analysis, we need
  234. 8:46to be having a normalized data. And
  235. 8:49obviously, we have need to clean clean
  236. 8:50it meaning remove all the junk data, the
  237. 8:52noise, the fake data, the missing data,
  238. 8:55and so on.
  239. 8:56So, now hopefully we can generate a
  240. 8:58model in the business world as well. In
  241. 9:00business, most likely regression is very
  242. 9:02popular cuz we do a lot of prediction.
  243. 9:05So, you could expect regression models
  244. 9:07that we've talked about. Classification
  245. 9:09uh to make a decision. Should I buy?
  246. 9:11Should I sell? You know, if you you're
  247. 9:12looking at stocks, so we're looking at
  248. 9:14classification. And you can have
  249. 9:16clustering to do some kind of customer
  250. 9:19segmentation. We've talked about this
  251. 9:20before. These customers look alike, so
  252. 9:23we do clustering. So, you can see a lot
  253. 9:25of models are employed that you have
  254. 9:27learned already um in the business
  255. 9:29world, in the finance world. So, we
  256. 9:31deploy it in real-time systems. So, some
  257. 9:33key applications I'll talk about and do
  258. 9:35some examples as we go on.
  259. 9:38Then fraud detection,
  260. 9:40that's a very common example. Can we
  261. 9:42detect fraud? And this is really
  262. 9:44interesting. I mean, for those of you
  263. 9:46have credit cards, you would know this.
  264. 9:48I mean, I get phone calls at midnight
  265. 9:50sometimes like, "Did you do this
  266. 9:51transaction?" I'd be sitting and buying
  267. 9:52in Amazon. And they Or if I haven't
  268. 9:56bought anything for the last 2 months,
  269. 9:57all of a sudden I buy I don't know,
  270. 10:00Alibaba.com.
  271. 10:02I haven't bought from Alibaba for the
  272. 10:03last 2 months, I'm buying it $1,000. It
  273. 10:06will flag it, right? So, this is simple.
  274. 10:08This has been there. It's not AI. It's a
  275. 10:10simple if statement that they put in the
  276. 10:13code somewhere. Like, "If this happens,
  277. 10:15be careful. Have a counter plus plus."
  278. 10:17So, almost any anybody can design this
  279. 10:20simple basic application. Okay, this is
  280. 10:225 or 10 years ago. That's what I'm
  281. 10:24talking about.
  282. 10:25Obviously, with AI, we could do
  283. 10:28500 times better. Cuz you you monitor
  284. 10:31behavior. You monitor how things are
  285. 10:33done. Um anything suspicious, meaning it
  286. 10:36doesn't belong to a pattern. So,
  287. 10:38ideally, this is how AI works. It's all
  288. 10:40about patterns. And something that
  289. 10:42doesn't belong there, an anomaly, uh it
  290. 10:45it's kind of flags it. And this anomaly
  291. 10:47could be something basic like, "I
  292. 10:49haven't done this ever. I do it." We can
  293. 10:51detect as human. But it could be way
  294. 10:53more than this. I mean, it could be from
  295. 10:54the basic things of the way you're even
  296. 10:56typing your password. Imagine. You know,
  297. 11:00if you go to an ATM machine with the
  298. 11:01advanced ATMs,
  299. 11:04and if you're putting my password, I'm
  300. 11:05not going to say my password now. My
  301. 11:07password is A B C D. A, then I spend
  302. 11:11maybe 2 seconds to put the B, another 2
  303. 11:13seconds to put the C. And every time
  304. 11:16I've went to the ATM machine for the
  305. 11:17last, I don't know, 10 years,
  306. 11:20most likely me, if I know my PIN, you
  307. 11:23know, this amount of time I spent on
  308. 11:26every letter to move my finger from here
  309. 11:28would kind of be the same, right?
  310. 11:31So, if one day I put an A
  311. 11:33then I scratch, I put the B, then I
  312. 11:36scratch, I took the what's I put C. This
  313. 11:38would be flagged. I'm not saying it's
  314. 11:39going to say, "Oh, he definitely is not
  315. 11:42the Muhammad." It will be flagged. Maybe
  316. 11:44the camera will record a minute of it or
  317. 11:47will send a human to check it out. So,
  318. 11:50you could see because I did something
  319. 11:51away from the pattern. And this is
  320. 11:54really a good example of fraud detection
  321. 11:55what I just did now. I didn't improvise
  322. 11:57this. Usually I prepare before
  323. 11:59recording. Sometimes I improvise on the
  324. 12:01spot. So, this is one of the things I
  325. 12:03improvise, but it's a good example.
  326. 12:05Okay? So, fraud detection.
  327. 12:07Credit scoring, you know, in the US, if
  328. 12:10you're in the US uh there's something
  329. 12:12called credit scoring. So, you know,
  330. 12:13when they want to give you a credit
  331. 12:14card, the limit is 5,000. If you were
  332. 12:17paying on time, you know, respecting the
  333. 12:20due dates of your payments at the end of
  334. 12:22each month, your score could be more up.
  335. 12:24So, that's why they give you a score. If
  336. 12:26you did some kind of fraud, your score
  337. 12:27could be down. If you they catch you
  338. 12:29stealing So, score has a formula. So, we
  339. 12:32could now use AI in order to really rank
  340. 12:35good people financially. You see that if
  341. 12:38you want to give you a loan, you know,
  342. 12:40your credit score is high, I will give
  343. 12:41you a loan. So, again, before it's using
  344. 12:43a formula, simple. Um adding and
  345. 12:46multiplying some numbers. Now, I could
  346. 12:48look at behavior over time.
  347. 12:51Stock prediction, as I said, for those
  348. 12:53who do it deal stocks, I I I recommend,
  349. 12:55by the way, playing around with stocks
  350. 12:57virtually, not buying really, you know,
  351. 12:59using these simulators to see if you
  352. 13:01actually invested in this how it would
  353. 13:03happen and so on. It's interesting in
  354. 13:05the business world. So, yes, obviously
  355. 13:07now it could make better recommendation
  356. 13:09by looking at patterns. This is risky,
  357. 13:12you know, because if we're all using AI
  358. 13:15we're all using the same prediction
  359. 13:16systems, uh this is the big question,
  360. 13:19right? So, if then we're all going to
  361. 13:20buy at the same time and sell at the
  362. 13:22same time, which would cause chaos.
  363. 13:24Which is the market will change
  364. 13:26completely. So, all the predictions will
  365. 13:28fail. So, it's there is a thin line
  366. 13:30here, you know,
  367. 13:33if the agents my agent doesn't talk to
  368. 13:35your agent, which is not usually the
  369. 13:37case. Something I'll be talking about
  370. 13:39later on also.
  371. 13:41Regarding AI agents socializing with
  372. 13:44each other, communicating with each
  373. 13:46other, having their own Instagram, an
  374. 13:48Instagram of AI agents, Instagram for
  375. 13:50AIs. Humans are not allowed and this is
  376. 13:52there. So, get get ready when I talk
  377. 13:54about it in the
  378. 13:56coming lectures. I am I am very excited.
  379. 13:57Okay. So, stock prediction, yes, it
  380. 14:00could help us with stock prediction.
  381. 14:01Customer segmentation, I've talked about
  382. 14:02this before. Maybe K-means clustering
  383. 14:05could be an option unsupervised looking
  384. 14:07at their patterns
  385. 14:08how they're buying, how they're selling,
  386. 14:10what they're like, what they don't like.
  387. 14:12And making recommendation system example
  388. 14:14again, maybe Amazon is a good example
  389. 14:16buy this, sell this. You bought this,
  390. 14:18why don't you buy this? You know, your
  391. 14:20friend bought this, why don't you buy
  392. 14:22this? There are formulas, you know,
  393. 14:24there are things that it's learning and
  394. 14:26enhancing over time. Okay?
  395. 14:29So, let's talk about fraud detection.
  396. 14:30So, the idea is obvious, we've got to
  397. 14:32detect transactions that are suspicious
  398. 14:35using some kind of classification model.
  399. 14:38So, it is a real-time classification
  400. 14:40model. There's a AI models. Most likely,
  401. 14:43now obviously you could do better, but
  402. 14:45binary classification maybe is the
  403. 14:47easiest. Again, when I talk about these
  404. 14:48I don't want to go too technical, but
  405. 14:50still we'll give some example, but
  406. 14:52binary is the easiest. It's either fraud
  407. 14:54or no fraud, right? Zero or one. That's
  408. 14:56why we call it binary. So, it's fraud or
  409. 14:59it's not fraud.
  410. 15:01Of course, we can make it more
  411. 15:03interesting, make it fuzzy. Fuzzy
  412. 15:05classification meaning it could be one,
  413. 15:08could be 0.5, 0.7, a probability between
  414. 15:11zero and one.
  415. 15:12It's a fraud, so it's more probabilistic
  416. 15:15model versus simply binary
  417. 15:17classification. Well, binary would work.
  418. 15:19So, this could be an example of a
  419. 15:21distribution that we get. So, these are
  420. 15:23the ones that are legit. These are the
  421. 15:25ones flagged or these are the one really
  422. 15:27fraud. So, you could have a simple a bar
  423. 15:30uh distribution to to kind of visualize
  424. 15:32it.
  425. 15:33So, let's look at some features.
  426. 15:35So, when I'm detecting this, we could
  427. 15:37have many variables. I mentioned some
  428. 15:39here. Let's call them features. These
  429. 15:40are the things that I'm going to use in
  430. 15:42my model. Remember when we did Google
  431. 15:44Teachable Machine example, you're giving
  432. 15:46it images.
  433. 15:48When you're giving it an image, you have
  434. 15:49facial
  435. 15:51uh features. That's kind of, you know,
  436. 15:53if you're doing neural network
  437. 15:55or deep learning, you have millions and
  438. 15:57millions, right? So, these are the
  439. 15:59features that you give the model to
  440. 16:01learn from it in order to detect
  441. 16:03something. Again, when it comes to the
  442. 16:05features and fraud detection, for
  443. 16:06example,
  444. 16:08uh
  445. 16:08what do we need to know? Of course,
  446. 16:09transaction amount,
  447. 16:11a good example. Location, you know, if
  448. 16:13I'm in I don't know in in um
  449. 16:16in Singapore, I never been there. I even
  450. 16:19buy a a a ticket there, they could see,
  451. 16:21you know, AI would know later on if I
  452. 16:23bought a ticket to make the correlation.
  453. 16:26In my credit card, you haven't bought a
  454. 16:28ticket, all of a sudden you're in Sri
  455. 16:29Lanka buying uh I don't know um
  456. 16:33uh sweets, right? So, maybe you don't
  457. 16:35even eat sweets. How did it know?
  458. 16:37Because it tracked. You could see it
  459. 16:39kind of knows you now. AI is learning,
  460. 16:41so a simple thing is that transaction,
  461. 16:44how big the amount is, the location, the
  462. 16:46time, the frequencies. I could add much
  463. 16:48more. I only add four. I could add the
  464. 16:50ones I mentioned now. Uh patterns
  465. 16:53between credit card statements, you
  466. 16:55know,
  467. 16:56um and so on.
  468. 16:58So, these are features that could be
  469. 16:59given to the model. And then we could do
  470. 17:02logistic regression. We've talked about
  471. 17:03this. Did not give you an example then.
  472. 17:05I'll give you an example today how to
  473. 17:07actually use it. You need to know it's
  474. 17:09very simple formula. Again, if this was
  475. 17:11an exam or something, you I'll give you
  476. 17:12the formula. You need to understand it.
  477. 17:14That's that's the important part.
  478. 17:17Decision trees, we've done decision
  479. 17:18trees before, you remember that? Neural
  480. 17:20networks, these are things that could be
  481. 17:21beneficial a lot, especially neural
  482. 17:23network, uh deep learning, uh to to
  483. 17:27figure out frauds or no frauds, okay?
  484. 17:30We could have the same confusion matrix
  485. 17:32like before, the faults, remember the
  486. 17:34confusion matrix? If you don't remember
  487. 17:36them, true positive, true negative,
  488. 17:38these are good stuff. Again, true
  489. 17:41meaning good.
  490. 17:42True positive, true negative meaning the
  491. 17:44AI was able to detect a fraud when it
  492. 17:48was actually a fraud.
  493. 17:50True negative, the AI was able to detect
  494. 17:53that's not a fraud when it's not a
  495. 17:56fraud, you know? So, these are good
  496. 17:57things. Then, the false positive, false
  497. 17:59negative are the bad things, meaning we
  498. 18:01flipped it. The AI got it wrong. So, for
  499. 18:04example, false negative, it's fraud, but
  500. 18:07we missed it, and this is obviously the
  501. 18:09most critical. False negative, it's bad.
  502. 18:12The AI did not figure it out, but it was
  503. 18:13indeed a fraud. Now, false positive, it
  504. 18:16still got it wrong, but it's not a big
  505. 18:18deal, you know? It says it's fraud, but
  506. 18:20it's not a fraud. Then, we we looked it
  507. 18:22up, we figured out it is a mistake. So,
  508. 18:24false negative negative is critical here
  509. 18:26as we did before. When we did
  510. 18:28healthcare, you know, we analyzed this,
  511. 18:30so you need to really under- This is
  512. 18:32really so important. So, false negative,
  513. 18:35we missed a fraud. Obviously, it's going
  514. 18:37to cause loss, uh the criminal will get
  515. 18:39away, we did not catch him. Uh false
  516. 18:42positive, as I said, it's inconvenient.
  517. 18:44He has to go to make some phone calls.
  518. 18:45Some people get angry cuz we got to
  519. 18:47accuse them and then figure out we did a
  520. 18:49mistake. Very simple to do when we do
  521. 18:51exams online, you know, and we have a
  522. 18:54camera, it's watching you, and a
  523. 18:56lockdown browser, and the AI There is an
  524. 18:59AI, not very smart, still work They're
  525. 19:01still working on this. The AI will see
  526. 19:03if I'm I'm looking there, it will flag
  527. 19:06you. If you're looking down, it will
  528. 19:07flag you. We as professors will watch
  529. 19:10these snippets. Say, "Ah, you know what?
  530. 19:12No, he was doing it. He wasn't cheating.
  531. 19:14And we kind of could see if you're
  532. 19:15talking and whispering. It will flag all
  533. 19:17these. And it's based on very simple
  534. 19:20algorithm of just watching your
  535. 19:22movements, your eyes, retina looking up
  536. 19:25and down, videos look for an amount of
  537. 19:27time. So, these are the features that
  538. 19:29are fed into the model. So, back to
  539. 19:31this. So, actual fraud, actual legit.
  540. 19:34So, legit versus fraud, predicted fraud
  541. 19:37versus predicted legit. So, we have true
  542. 19:39positive to negative as I told you. So,
  543. 19:41we predict legit when it's actually
  544. 19:43legit. And actual fraud, we predict it,
  545. 19:46so that's true positive. And false
  546. 19:48negative and false positive. So, we
  547. 19:49could do a small example like we did
  548. 19:51before.
  549. 19:52Okay? So, you could see
  550. 19:561,000 transactions. Supposedly, we had
  551. 19:5850 cases of fraud.
  552. 20:00You know, the model detected the true
  553. 20:04positives were 40, the true negatives
  554. 20:06were 850. You always expect the legit to
  555. 20:09be more than the fraud. Uh false
  556. 20:11positive 100 false negative 10. So, I
  557. 20:13want you to calculate the accuracy,
  558. 20:14precision, and recall. Again,
  559. 20:17easy. Well, accuracy, it's all about,
  560. 20:20remember, true positives, we're looking
  561. 20:22at basically how well we did. So,
  562. 20:25accuracy, it's about you could see true
  563. 20:28positives,
  564. 20:29true negatives over the total. The total
  565. 20:32was 1,000 of them.
  566. 20:34So, that's how accurate we were, 89%.
  567. 20:37So, I I told you you need to definitely
  568. 20:38know accuracy, precision. These two
  569. 20:42things you definitely need to know them
  570. 20:43by heart. And again, recall is also
  571. 20:45something important to know. So,
  572. 20:47accuracy, easy. We could calculate it 2
  573. 20:49seconds. Precision are the P's. Just
  574. 20:52This is a trick. For I remember it like
  575. 20:54this. The P's.
  576. 20:56So, we're looking at
  577. 20:58TP like again like before, true positive
  578. 21:00is my
  579. 21:01numerator. Always my numerator true
  580. 21:03positive. You know, when we look at
  581. 21:06precision or recall. true positive, this
  582. 21:08is where how we get good. Accuracy puts
  583. 21:10the true negative with it.
  584. 21:11But usually you put true positive. So,
  585. 21:14true positive over the P P's. So, how
  586. 21:16many P's we have? These TP, FP. So, 40 +
  587. 21:19100, you see them? It's how you remember
  588. 21:21this formula for life. You will never
  589. 21:23forget this, even after this course.
  590. 21:24Anyway, that's you, "Oh, yeah, I get
  591. 21:26it." True positive, TP over TP + FP,
  592. 21:29PPP. The others don't have P. P P be
  593. 21:31positive. So, we're looking only you're
  594. 21:33being positive. Think about precision,
  595. 21:35you are a positive person. So, you're
  596. 21:37only looking at the positives. So, you
  597. 21:38could see true positive over true
  598. 21:40positive
  599. 21:41um over uh plus four false positive.
  600. 21:45That's what precision is. Okay?
  601. 21:48Um
  602. 21:49the
  603. 21:50last one, which is recall, again, true
  604. 21:52positive. So, now I'm adding the true
  605. 21:56positive again. So, this is similar to
  606. 21:58this. You can see true positive over
  607. 21:59true positive. True positive over true
  608. 22:01positive. The difference here, I don't
  609. 22:03put the false positive, I put the false
  610. 22:06negative. So, I'm being negative here,
  611. 22:08in case you want to remember this. So,
  612. 22:09recall and precision are identical,
  613. 22:11except instead of using the 100, which
  614. 22:14is the false positive, I'm going to take
  615. 22:16the false negative, 80%. You could see,
  616. 22:19precision
  617. 22:20is 28%
  618. 22:23right?
  619. 22:24Um accuracy is 89%.
  620. 22:28You could see now, people think, yeah,
  621. 22:30precision and accuracy are close. You
  622. 22:31know, in the health care, they were very
  623. 22:33close numbers. And this on purpose I
  624. 22:35wanted to put an example you could see.
  625. 22:36And the obvious reason is the 850 here.
  626. 22:39So, I'm looking at the true negative is
  627. 22:41what really affected it compared to
  628. 22:43this. It's a big number. That's why as
  629. 22:45you can see the the the fluctuation,
  630. 22:47okay?
  631. 22:48Okay, so high recall is usually a good
  632. 22:51thing. Low precision, meaning we have
  633. 22:53many false alarms. That's what it means.
  634. 22:56So, we have false alarms. That's what
  635. 22:57precision means. It's still accurate
  636. 22:59model, but we have false alarms. Okay?
  637. 23:02So, this is a good example. Let's give
  638. 23:04you example of which is the first
  639. 23:05example business and finance was how can
  640. 23:07you use AI in the world of fraud
  641. 23:10detection is a big topic. How can you
  642. 23:12use AI for credit scoring? So,
  643. 23:14we could predict the loan default. As I
  644. 23:17said when I started so credit scoring
  645. 23:19gives you a a score each one of us based
  646. 23:21on our history. Which is good. But with
  647. 23:24AI I could do predictions now in the
  648. 23:27future. So, that's simply a formula.
  649. 23:29Before it was ah your score is ah
  650. 23:32X whatever that X is. Ah X is good. You
  651. 23:35give you a loan. Now no, I will not only
  652. 23:38look at X I will do some prediction
  653. 23:40modeling. So, you could predict would he
  654. 23:42pay his loan if I give him a loan? If I
  655. 23:44give him a credit card a new credit
  656. 23:45card, will he end up paying it? So, I
  657. 23:47could do this prediction. So, you could
  658. 23:49look at income, credit history, debt,
  659. 23:52ah maybe the way you're spending your
  660. 23:54money, you know, um how it's
  661. 23:56fluctuating, how you're traveling not
  662. 23:58traveling, how many kids you have. I
  663. 24:00could give inputs again and again the
  664. 24:02more inputs you give it, the more
  665. 24:04accurate this kind of model will become.
  666. 24:05So, typically we want to either approve
  667. 24:08the loan or reject the loan based on the
  668. 24:11probability of default. So, a a good
  669. 24:13model will be a logistic regression.
  670. 24:15I've talked about this before. Again, if
  671. 24:17you remember it is not regression it's a
  672. 24:19classification although it's called
  673. 24:21logistic regression.
  674. 24:23Um the formula is this. Don't panic.
  675. 24:26Again, if this was an exam, I'd
  676. 24:28definitely give you this one but you
  677. 24:29need to know how to plug in the values
  678. 24:31and understand what it means. Simple.
  679. 24:33It's going to find the probability Y
  680. 24:35equal to one. The good thing about this
  681. 24:37model is so simple. You find this
  682. 24:39formula and it's going to be between
  683. 24:40zero and one. The closer it is to one,
  684. 24:43then our prediction it's a one.
  685. 24:46The closer it is to zero, then our
  686. 24:48prediction is zero. So, again one
  687. 24:49meaning approve, zero meaning don't
  688. 24:52approve. 0.5 is a gray area. And the
  689. 24:55closer above 0.5 meaning I will approve
  690. 24:58this loan.
  691. 24:59Below 0.5, I will not approve this loan.
  692. 25:02That's it. Again, the formula takes
  693. 25:04these parameters, X1, X2, X3, X4, X5, as
  694. 25:09many as I want you to get. I I This case
  695. 25:11I I'm looking at income, credit history,
  696. 25:13debt. Then we'll have these values. We
  697. 25:15need to normalize them, of course.
  698. 25:17Again, they need to be normalized for
  699. 25:20you to plug in this formula and have
  700. 25:22weights. These weights you don't define
  701. 25:24them. The model will define them. That's
  702. 25:25why it's called, you know, it's a
  703. 25:27machine learning model. We don't know
  704. 25:29what W1, W2, W3 are. These are depending
  705. 25:32on, you know, the model that we
  706. 25:34generated. So, the model basically will
  707. 25:36give us a function with these Ws
  708. 25:38defined. And E is exponential, in case
  709. 25:40you don't know math.
  710. 25:41E is a simple exponential model. Simple.
  711. 25:44Okay? So, probability of default is what
  712. 25:46this is. Let me give you an example. All
  713. 25:48is good.
  714. 25:49So, if I tell you X1 is the income
  715. 25:52score, X2 is the debt. I'm not going to
  716. 25:54give you X3 and 4. I can. You just have
  717. 25:56to plug them in the calculator. So,
  718. 25:58assume the model learned. We did some
  719. 25:59machine learning model. It learned the
  720. 26:02weights. So, W1 was -0.8
  721. 26:05for X1. So, for my income, it's
  722. 26:07negative. It's -0.8.
  723. 26:11My income score and it's 1.5 my debt
  724. 26:15score.
  725. 26:16So, the weight of the debt is 1.5. The
  726. 26:19weight of my income is a negative point
  727. 26:21eight.
  728. 26:23Again, for one customer, we had his
  729. 26:26income was two. Again, whatever that two
  730. 26:28means. $2,000, we put two, for example.
  731. 26:31Okay? And one was his debt score.
  732. 26:34There's a score for his debt. The
  733. 26:36question is, should we give him a loan
  734. 26:38or not? As simple as that. Using,
  735. 26:40obviously, logistic regression. Let's do
  736. 26:43this. Simple. We have the formula. I'm
  737. 26:45going to write the formula again one
  738. 26:46more time. 1 over 1 plus E to the power
  739. 26:49minus W1, X1. We have W1. We have X1.
  740. 26:52W1, W2, we have W2, we have X2. Again,
  741. 26:55this gets used to how to use the
  742. 26:57calculator. I'm not going to teach you
  743. 26:58this.
  744. 26:59So, it's basic, so we going to put it in
  745. 27:00the formula. I put it here. You know,
  746. 27:03minus 0.8, let me calculate it. So, I
  747. 27:05did the math. The math was 0.475.
  748. 27:09Aha, it's a bit gray area, huh? 0.475,
  749. 27:12so it's almost exactly what I was
  750. 27:13saying. Yes, it's still less than 0.5,
  751. 27:16but 0.475,
  752. 27:18it's gray in the middle. So, it's a
  753. 27:20decision, it's kind of yours as a human.
  754. 27:22It's not very obvious, right? So, the
  755. 27:24probability of default
  756. 27:27is 0.475.
  757. 27:29So,
  758. 27:30the model says 47.5%
  759. 27:34the customer belongs to this class one,
  760. 27:36whatever class one that you define. So,
  761. 27:38if we define class one as default,
  762. 27:41meaning they would not pay, right? So,
  763. 27:42default probability is 47.5. So, should
  764. 27:46we uh again,
  765. 27:48uh default is 47.5, not default is 52.5,
  766. 27:52right? So, again, I said it's a gray
  767. 27:55area, it's not 50/50. So, we could
  768. 27:57classify them
  769. 27:59um as not likely to default. So, uh if
  770. 28:03you look at it from the beginning,
  771. 28:05again, the minus 0.8, therefore, higher
  772. 28:09income score reduces the risk. You could
  773. 28:13see it.
  774. 28:14So, because it's a negative, more
  775. 28:16income, this will be reduced it. And
  776. 28:18this is 1.5, higher debt score will
  777. 28:21increase the risk because it's a
  778. 28:23positive, right? So, again, the idea is
  779. 28:26this will allow us to figure out
  780. 28:29uh the probability of default. So, this
  781. 28:31was
  782. 28:32in the real world, it's going to keep on
  783. 28:34doing it all the time using this and
  784. 28:36classifying you as a do you belong to
  785. 28:38those who will be defaulting or
  786. 28:42not likely to default. In this case, you
  787. 28:45could see depending on what what the
  788. 28:47class was. In this case, I define it as
  789. 28:49default. Probability of default is what
  790. 28:52this is. So, it's only 47%
  791. 28:56they will default. Right? Which means
  792. 28:58they're more likely
  793. 29:00not to default because it's a bit high.
  794. 29:02But, later on
  795. 29:04again, we could avoid these gray areas
  796. 29:06as I said.
  797. 29:07Uh and the human will decide on it. But,
  798. 29:09it's kind of interesting how we we can
  799. 29:13use logistic regression to classify
  800. 29:15people in the finance and business
  801. 29:17world. So, again, let me give you a
  802. 29:19scenario. So, the model predicts again
  803. 29:230.8 default risk. Customer B 0.3. So,
  804. 29:28who gets the loan? You want to pick
  805. 29:30customer A customer B? I I
  806. 29:32Obviously, who's going to get the loan?
  807. 29:34We're going to go with B because the
  808. 29:37default risk probability is less. So,
  809. 29:40again, this could be with comparing. It
  810. 29:42doesn't only have to be between 0.5 and
  811. 29:451 and deciding. So, you want to classify
  812. 29:47them on what category they belong to.
  813. 29:49Okay?
  814. 29:50So, we gave an example on credit score,
  815. 29:53loan prediction.
  816. 29:56Um
  817. 29:56okay? So, let's continue giving some
  818. 29:58more fraud detection as well. That was
  819. 30:01the first example. Stock prediction. So,
  820. 30:03I want to predict stocks. So, how would
  821. 30:05we do that? So, obviously, you could
  822. 30:07predict the prices of future stocks.
  823. 30:08It's going to make people money,
  824. 30:11millions and billions. So, data we need
  825. 30:13are historical patterns. I If you've
  826. 30:14seen these charts before, I'll show you
  827. 30:16some in a second. These historical
  828. 30:18patterns will give us an idea what the
  829. 30:20future price would be. Maybe the news. I
  830. 30:23mean, if you're watching the news today,
  831. 30:24you know, this is a trendy lecture.
  832. 30:27Trump Donald Trump says something, he
  833. 30:30tweets something, tomorrow the stocks
  834. 30:32will go down. He says, "I'll do peace."
  835. 30:35The stocks will go up. You know, like
  836. 30:37I'm giving you an example how an
  837. 30:38influencer, in this case a president,
  838. 30:41can really affect these prices and the
  839. 30:43AI kind of is reading all these behind
  840. 30:46the scenes. So, we're looking at
  841. 30:47historical data and we're only looking
  842. 30:49and we're also looking at the news.
  843. 30:52Market trends as well.
  844. 30:54So, usually we use something called time
  845. 30:56series models. Think about it as a curve
  846. 30:59over time. You know, we have the long
  847. 31:01short term memory, which is the LSTM.
  848. 31:05Uh this is a type of RNN. We've talked
  849. 31:07about RNN before. Recurrent neural
  850. 31:09networks. We talked about ANN,
  851. 31:10artificial neural network. Talk about
  852. 31:13CNN, convolution neural network. Again,
  853. 31:15RNN we also talked about it. Uh which is
  854. 31:18recurrent neural network. One of them is
  855. 31:19called LSTM. Again, don't worry about
  856. 31:21the technicalities. Just remember it's
  857. 31:23under this kind of uh deep learning
  858. 31:26model, recurrent neural network, uh
  859. 31:29which will again uh have deep learning
  860. 31:32into it, hidden layers, in order to have
  861. 31:34some kind of prediction model. Uses
  862. 31:36transformers as well, similar to what
  863. 31:38GPT does, you know, generative
  864. 31:41pre-processing transformers. So,
  865. 31:43transformer model, which is a type of
  866. 31:45machine learning as well. So, you can
  867. 31:47think about it. The idea at the end of
  868. 31:48the day, I want to look at price of T
  869. 31:50plus one, T's time, the next or the next
  870. 31:54data point. If this is a price model,
  871. 31:57you know, I stop here. I want to look at
  872. 31:58the next one. So, think about it as
  873. 32:00price T plus one, so a future model is a
  874. 32:03function of price, volume, news, and
  875. 32:07many other things, right? So, I want I
  876. 32:09will have a function of this. This is
  877. 32:10something I would predict. I would
  878. 32:12generate from these models. So, I would
  879. 32:15feed in all these data, generate this
  880. 32:17machine learning model that we can use
  881. 32:20for future predictions. This is the
  882. 32:21idea. So,
  883. 32:23tomorrow's price depends on today's
  884. 32:25price, volume, news, sentiment,
  885. 32:29emotions, you know?
  886. 32:31Uh there's a lot of randomness. There
  887. 32:33are things that could happen beyond your
  888. 32:34control. All of a sudden, there is war.
  889. 32:37The model cannot predict war, or maybe
  890. 32:39it can. Uh some external factors, some
  891. 32:41noise even there. So,
  892. 32:44for example, let me give you an example,
  893. 32:45like I always do.
  894. 32:46Suppose I have a a price model, like
  895. 32:49before, is 0.6 price of D to the
  896. 32:53previous price The future price is the
  897. 32:55current price at 0.6
  898. 32:570.2 + 0.2 * volume + 0.3 * news. Again,
  899. 33:02I gave you a very very basic linear
  900. 33:05model. It's not always the case, but
  901. 33:07assume this is the model that we
  902. 33:08generated
  903. 33:10using, again, deep learning and
  904. 33:12transformers. So,
  905. 33:14suppose today the price is $100, the
  906. 33:17volume is 50, we normalize it, as I
  907. 33:19said, on a scale. Then, news is 0.8,
  908. 33:22again, normalized, assuming it's between
  909. 33:24-1 and 1. So, this is meaning
  910. 33:26sentiments. How positive is the news,
  911. 33:29right? So, how positive? 0.8, kind of
  912. 33:31positive, good news. So, think about it
  913. 33:34as 0.8 meaning the news is good.
  914. 33:37Obviously, if it's negative, it's bad,
  915. 33:39and something in the middle, it's not.
  916. 33:41So, based on this, I could plug in the
  917. 33:42value. I plug them in, ta-da-da, just
  918. 33:45multiply, we all know how to multiply.
  919. 33:48We get $70. Wow. So, the price was $100.
  920. 33:53Our predicted model predict the next
  921. 33:55price is $70. So, if you're trading, if
  922. 33:58you're trading online, and you see the
  923. 34:00price is going down, go ahead and sell
  924. 34:02now, immediately, right? You're going to
  925. 34:04lose $30 if this prediction model's any
  926. 34:08It's kind of accurate, depending on
  927. 34:09accuracy. Again, we've talked about
  928. 34:10accuracy before.
  929. 34:12So,
  930. 34:13the model predicts a lower price, so,
  931. 34:16even though the news is positive,
  932. 34:19the model still predicts a huge drop.
  933. 34:22So, why is that? Ask yourself, why?
  934. 34:25Look at this, why? Because the dominant
  935. 34:28factor was what?
  936. 34:30Okay? The price weight decrease by 0.6
  937. 34:35automatically. So, the price weight here
  938. 34:38is what was dominating this whole model.
  939. 34:41Yes, the news affected it, but not much.
  940. 34:44So, that's why. You could look at this
  941. 34:45and you can see obviously 0.6, this
  942. 34:47coefficient is really what affected the
  943. 34:50decrease. And before I do anything, I
  944. 34:52already lost
  945. 34:5340% of my value. I started with a 100 *
  946. 34:570.6, that's 60. I lost already 40, and
  947. 35:00the others tried to help, you know? The
  948. 35:03news increased it a bit, and the volume
  949. 35:07also did not do what? Increased it a bit
  950. 35:09as well. Okay? So, by one.
  951. 35:11But, this did mu- mu- much of the heavy
  952. 35:14lifting, right? And this one is kind of
  953. 35:16did the heavy lifting downwards.
  954. 35:19Affected. So, this is really
  955. 35:20interesting, and this is why I want you
  956. 35:22to really reflect on these examples.
  957. 35:25It's not about the formulas. Excel can
  958. 35:27do it. ChatGPT can give you these
  959. 35:29formulas.
  960. 35:30It's about you understanding and making
  961. 35:32human decisions. And this is what I I
  962. 35:35always try to focus on. Okay. So, guys,
  963. 35:37this is an example of this time series I
  964. 35:39was telling you about. Stocks over time,
  965. 35:41you could see. You could see
  966. 35:44the data. We have daily stock sales,
  967. 35:46website traffic, anything we could we
  968. 35:48could plot its data. There is a trend
  969. 35:51you could see here upward. We have some
  970. 35:53fluctuations. So, you could see it's
  971. 35:54going up, then it fluctuates a bit here,
  972. 35:57then goes up again, then fluctuates
  973. 35:59here. Then it goes up, fluctuates here.
  974. 36:01So, So, these are again, you can have
  975. 36:02noise even there. So, the idea is AI
  976. 36:06learns patterns, tries to understand
  977. 36:07what's happening. So, when it fluctuated
  978. 36:09here, what happened? When it went from
  979. 36:12here to here? It tried to figure out
  980. 36:14what are the things happening in its
  981. 36:16model in the specific time that caused
  982. 36:20this decrease. Same thing here and here
  983. 36:22and there. So,
  984. 36:24is it predictable? Of Of it's
  985. 36:25predictable to an extent. We do still
  986. 36:27have random events,
  987. 36:29but there are trends that we can use in
  988. 36:31order to generate beautiful models.
  989. 36:35Again,
  990. 36:36one of the things that will happen
  991. 36:39we do have noise. What is noise? Meaning
  992. 36:41data that don't don't belong there.
  993. 36:44Things that happened or they're
  994. 36:45affecting our time series to look ugly,
  995. 36:48not very smooth.
  996. 36:50We call these noise. So, what people do
  997. 36:52usually do is something called the
  998. 36:53moving average. Very simple. Instead of
  999. 36:56me always taking the points, I will take
  1000. 36:58the average of the points. Very similar
  1001. 36:59to what we do in filtering. You know, if
  1002. 37:02I'm using a filter now in the camera,
  1003. 37:04okay, or use it when you take pictures,
  1004. 37:06what it does it does the filter. This
  1005. 37:07filter is doing the moving average. It's
  1006. 37:09taking, you know, your your skin around
  1007. 37:13here and if there's something
  1008. 37:14anomaly, maybe a pimple, it will take
  1009. 37:17the average the color and divide it and
  1010. 37:21then put it instead of that point. You
  1011. 37:24would see that it went away as if you
  1012. 37:25erased it, you know? So, think about
  1013. 37:27this what This is what the moving
  1014. 37:29average is. Simply taking the values
  1015. 37:32around a point. You could make N as big
  1016. 37:34as you want. The bigger it is, the
  1017. 37:37bigger the window is.
  1018. 37:39In order to be removed noise to an to an
  1019. 37:41extent, right? So, this will kind of
  1020. 37:44help us detect trends more efficiently,
  1021. 37:46ignore some kind of noise. So, it will
  1022. 37:48smooth the data. We don't want to always
  1023. 37:49do this, of course. Sometimes we won't
  1024. 37:53very smooth a lot. If this window If N
  1025. 37:55is very big, you might lose some things
  1026. 37:58that we need to know, of course, right?
  1027. 38:00So, so it's a very risky thing to do,
  1028. 38:02but still it's good to remove noise and
  1029. 38:04some sudden events over time. You can
  1030. 38:06see here, we have a moving average.
  1031. 38:09The orange thing is the moving average
  1032. 38:12and the actual data is this. So, yes,
  1033. 38:15you could see it's a smoother curve,
  1034. 38:17although it might hurt sometimes. So, we
  1035. 38:20You to avoid making N or averaging over
  1036. 38:23more points. That would cause
  1037. 38:26a worse performance, okay?
  1038. 38:28So, ideally I'm always comparing actual
  1039. 38:31versus forecasted. So, what you actually
  1040. 38:34got, what you predicted, what you
  1041. 38:36forecasted. So, it could give us an idea
  1042. 38:39uh
  1043. 38:40that of course our models won't give us
  1044. 38:42a perfect answer. They approximate. You
  1045. 38:44could see in this case, so if I had a
  1046. 38:46linear model, this is my linear model,
  1047. 38:48like the one I gave you for the price,
  1048. 38:50for example. That was purely linear.
  1049. 38:52Purely linear meaning it's a line.
  1050. 38:54Obviously, the real world is not a line.
  1051. 38:55You could see the forecasted and the
  1052. 38:58actual
  1053. 38:59uh compared to each other, okay?
  1054. 39:02So, the biggest prediction error is when
  1055. 39:05we have peaks, you know, when it's going
  1056. 39:06up, going down,
  1057. 39:08um
  1058. 39:09when it's not very volatile, we could
  1059. 39:11get some mistakes over time, okay?
  1060. 39:14So, another example that I'll talk about
  1061. 39:16are seasonal patterns. This is
  1062. 39:18interesting. I like this.
  1063. 39:19Seasonal patterns are ideally as things
  1064. 39:21happen over seasons, right? So, AI will
  1065. 39:24be able to detect this. So, repeating
  1066. 39:27patterns, for example, holiday sales,
  1067. 39:30right? I don't know if you know Black
  1068. 39:31Friday, uh
  1069. 39:33over summer. These are kind of obvious,
  1070. 39:35but sometimes we have other things,
  1071. 39:36other season, Easter, and so on. So,
  1072. 39:38these will affect our data. So, we
  1073. 39:40cannot simply look at the data that the
  1074. 39:42way we just looked at it now. Just plot
  1075. 39:44a curve over time. We can't because when
  1076. 39:46it went down here because something was
  1077. 39:48happening. There's a seasonal impact,
  1078. 39:50you know? Regular ups and downs, some
  1079. 39:53trends are there. So,
  1080. 39:56they usually repeat themselves because
  1081. 39:58of these specific seasons.
  1082. 40:00Uh so, if you look at here, you could
  1083. 40:01see these are seasonal sales. You could
  1084. 40:04see here, oh wow, it's a peak here.
  1085. 40:06Doesn't mean your restaurant is very
  1086. 40:09good. No, maybe this is a season. High
  1087. 40:11season versus low season, right? Even
  1088. 40:13plane tickets look at these patterns
  1089. 40:16when they put the price of the ticket
  1090. 40:18automatically. So, it's kind of easy if
  1091. 40:20it's fixed, if it's based on calendar
  1092. 40:22days, we don't need AI to do this.
  1093. 40:25Obviously, AI needs to use this in its
  1094. 40:27model when predicting because you don't
  1095. 40:29want it to be
  1096. 40:30confused about these seasons because we
  1097. 40:33don't have a consistent pattern over
  1098. 40:35time. So, obviously, examples would be,
  1099. 40:37as I said, Black Friday, Ramadan
  1100. 40:39shopping, which is where you know,
  1101. 40:41Ramadan, back to school, all these are
  1102. 40:44examples of seasonality. Uh
  1103. 40:47So,
  1104. 40:49anomalies
  1105. 40:50exist. We talked about fraud detection
  1106. 40:53before. So, these transactions are we
  1107. 40:56call them anomalies. Just in case these
  1108. 40:59points do not belong there, hence
  1109. 41:01they're abnormal. So, AI wants to focus
  1110. 41:03on these anomalies and figure out what
  1111. 41:07happened there and flag them because
  1112. 41:10humans might miss them. And this applies
  1113. 41:12not only to fraud. I only put fraud as
  1114. 41:14an example. Anomalies could apply to
  1115. 41:16stocks prediction, loan default. Loan
  1116. 41:20default, the guy won a lottery. You
  1117. 41:22know, all of a sudden, he's paying his
  1118. 41:24loan. It doesn't mean
  1119. 41:27this is the norm. This is an anomaly,
  1120. 41:30you know?
  1121. 41:31AI would be able to detect these as
  1122. 41:33well. So, anomalies could be present in
  1123. 41:36every single pattern in business and
  1124. 41:38finance, and our goal is to kind of
  1125. 41:40figure these out. This is an example of
  1126. 41:41anomalies. You can see these points are
  1127. 41:44anomalies, and
  1128. 41:47we in the fraud detection example, do we
  1129. 41:50have to detect each one of them as a
  1130. 41:51fraud? We don't have to, of course, but
  1131. 41:53most likely we flag them and we look at
  1132. 41:56them more. Some could be valid. So, a
  1133. 41:58human plus AI will work together to
  1134. 42:01figure out if it's an anomaly or not.
  1135. 42:03Okay?
  1136. 42:04The fifth example is customer
  1137. 42:06segmentation that I I talked about in
  1138. 42:08the beginning. So, we could use we group
  1139. 42:10customers to different groups.
  1140. 42:13This is very nice. So we use K-means
  1141. 42:15clustering. So we we put them in
  1142. 42:17specific clusters. We assign points to
  1143. 42:20them. And now we know that you belong to
  1144. 42:22this cluster. What it means? It means if
  1145. 42:24I'm doing a marketing campaign, if I
  1146. 42:26want to sell you something, you all guys
  1147. 42:28belong to the same cluster. So customer
  1148. 42:30segmentation is very popular when it
  1149. 42:32comes to you know, marketing, business
  1150. 42:34plans, targeted marketing, pricing
  1151. 42:37strategies. All these are things that we
  1152. 42:40could look at. So this is an example of
  1153. 42:42customer segmentation. So we have two
  1154. 42:43clusters, the blues and the oranges. And
  1155. 42:47therefore we could define
  1156. 42:50what to do with each. Okay?
  1157. 42:52So we're looking at AI. What does it
  1158. 42:55look?
  1159. 42:56Again, to summarize what I gave in these
  1160. 42:58examples and trends, we look at the
  1161. 43:00long-term direction, seasonality, we
  1162. 43:02look at repeating patterns, noise, we
  1163. 43:06look at randomness, anomalies,
  1164. 43:09we look at rare events. So AI tries to
  1165. 43:11learn these in its models. So these are
  1166. 43:14the things that it kind of tries to
  1167. 43:15learn in order
  1168. 43:18to have a nice prediction model, which
  1169. 43:20is based on the learning patterns and
  1170. 43:22had handling any uncertainty. Okay? So
  1171. 43:26again, just a quick review of what we
  1172. 43:28did. So stock prediction, what approach
  1173. 43:30should we use?
  1174. 43:32Time series. Fraud detection, anomaly
  1175. 43:35detection.
  1176. 43:36Sales forecasting, seasonality models.
  1177. 43:40So these are some examples of models
  1178. 43:41that we discussed today and the problems
  1179. 43:44that we have
  1180. 43:46in the business and finance world. Okay?
  1181. 43:49Six is recommendation systems.
  1182. 43:52In the business of finance. So we want
  1183. 43:53to make some recommendation. So the idea
  1184. 43:55is I want to suggest a product for you
  1185. 43:57to buy. Again, we've all seen it on
  1186. 43:58Amazon. If you use Amazon, similar to
  1187. 44:00Netflix recommending a movie.
  1188. 44:03Netflix, Amazon are very good examples.
  1189. 44:06So, we use collaborative filtering,
  1190. 44:09content-based
  1191. 44:11uh filtering as well and algorithms. We
  1192. 44:13use similarity.
  1193. 44:15So, we look at something called cosine
  1194. 44:17similarity to look at how close and how
  1195. 44:20similar users are. Again, don't panic. I
  1196. 44:23know you guys cosine similarity. I'm
  1197. 44:25panicking. Don't worry, they're very
  1198. 44:26easy. I'll give an example now. So,
  1199. 44:30for example, user likes action movies,
  1200. 44:32we recommend something similar. Uh what
  1201. 44:34we use is this. So, I'll talk about
  1202. 44:36collaborative filtering and
  1203. 44:37content-based as well uh later on, but
  1204. 44:40for now similarity is very interesting,
  1205. 44:42very simple. So, we want to define
  1206. 44:43something called a vector. Each user and
  1207. 44:46I want to see how similar users are. So,
  1208. 44:49when we make a recommendation, it's
  1209. 44:50similar to clustering. Clustering is a
  1210. 44:52bit uses something similar behind the
  1211. 44:54scenes. Here, we're only measuring
  1212. 44:56similarity and again, very similar to
  1213. 44:58friend uh friends' recommendation, how
  1214. 45:01similar people are. It's not simply he's
  1215. 45:03a friend of this, then therefore, you
  1216. 45:05should be a friend with him. No. We
  1217. 45:07don't look at similarities based on the
  1218. 45:09dot product formula, cosine formula.
  1219. 45:12Okay, let me give you an example.
  1220. 45:14Again, one more time, the the formula is
  1221. 45:16simple. It's A * B dot product, meaning
  1222. 45:20it's a vector. Uh I have A1, A2 and you
  1223. 45:23are B1, B2. This is a dot product. So,
  1224. 45:26it's going to be A1 * B1 + A2 * B2.
  1225. 45:30Simple. You You multiply them and the
  1226. 45:32the bottom part is the magnitude of A
  1227. 45:35and the magnitude of B. So, we're going
  1228. 45:37to take typically Euclidean, so A
  1229. 45:39squared + B squared. Like you find the
  1230. 45:41distance between two points. Once you do
  1231. 45:43the formula, you need to know this,
  1232. 45:45please. It's simple,
  1233. 45:47uh
  1234. 45:47but you need to know what it means.
  1235. 45:49That's what I care about more, not how
  1236. 45:51to calculate it, okay? So, let me give
  1237. 45:53you an example. You have two users
  1238. 45:54rating uh three movies.
  1239. 45:58Again, user A.
  1240. 45:59You know in Netflix, I will sometimes
  1241. 46:01ask us to rate a movie. So, I want to
  1242. 46:03put an example you can correlate with.
  1243. 46:04So I watched movies I gave the first one
  1244. 46:06530 and we gave it 432. Are these guys A
  1245. 46:10and B similar? Now if you look at it you
  1246. 46:12say oh doctor we don't need the formula.
  1247. 46:14It's about doctor right? Because they're
  1248. 46:16close right? It looks close. Like both
  1249. 46:18of us liked movie one, both of us like
  1250. 46:21liked movie two. Give it high.
  1251. 46:24And both both of us disliked movie
  1252. 46:26three. You give it two I give it a zero.
  1253. 46:28Suppose I'm A you're B. Yes we could
  1254. 46:30look at this but imagine you have a
  1255. 46:31million.
  1256. 46:32Let's put a billion
  1257. 46:34users over Netflix watching a thousand
  1258. 46:36movies. Then you have a thousand billion
  1259. 46:40of this table. Okay? Imagine how many
  1260. 46:42rows you have, how many mappings you
  1261. 46:44have. Not only A and B, A and B and C
  1262. 46:47and D and E and F.
  1263. 46:48And the thousand others and the billion
  1264. 46:50others.
  1265. 46:52So this would be when non-polynomial
  1266. 46:53time if you know a bit about algorithms.
  1267. 46:56It'll be an NP problem. There's no
  1268. 46:58solution for it.
  1269. 47:00By you simply looking and you can't even
  1270. 47:02see kind of do brute force and looping
  1271. 47:05on every one of them is going to be too
  1272. 47:06much. Obviously by looking at it the
  1273. 47:08example I made is simple but let's do
  1274. 47:10the formula. You know again if I have a
  1275. 47:12simple similarity formula one more time
  1276. 47:15AI does way more than this but I'm just
  1277. 47:17giving you an example for you to
  1278. 47:18understand.
  1279. 47:19So so I'm going to make them as vectors
  1280. 47:21so A is basically user A rated 530, 530
  1281. 47:26B rated 432. I want to find the dot
  1282. 47:29product and the magnitude because
  1283. 47:31similarity cosine formula works this
  1284. 47:33way. By the way you have many
  1285. 47:34similarities formulas not only one you
  1286. 47:36have about 10 of them we teach I teach
  1287. 47:38this in another course advanced not in
  1288. 47:41this course of course. You don't care
  1289. 47:42all you need to know are there's
  1290. 47:43something called similarity how similar
  1291. 47:46things are. So it's easy. So let's go
  1292. 47:48ahead and do this.
  1293. 47:49We do the dot product A.B 54 3*3 + 0*2.
  1294. 47:54Okay? So one more time 5*4 3*3 0*2 we
  1295. 47:59get 29. Again, this is my numerator. My
  1296. 48:02denominator is the distance between two
  1297. 48:04points. Something they taught you, I
  1298. 48:06don't know, intermediate school. You
  1299. 48:08know how to find the distance. So, let's
  1300. 48:10go ahead and do this. So, we compute the
  1301. 48:12magnitude, the distance is
  1302. 48:155 squared. So, A squared all these guys
  1303. 48:18under a square root. That's it. So, this
  1304. 48:19is what we call
  1305. 48:21Euclidean, basically, right? 5 squared +
  1306. 48:233 squared + 0 squared = 34. The
  1307. 48:25magnitude of B
  1308. 48:28Okay? It's 4 squared + 3 squared + 2
  1309. 48:31squared square root 29. Then we put it
  1310. 48:33in the formula. Let's go ahead and do
  1311. 48:34this. So, this is the formula in case
  1312. 48:36you forgot. We're going to put it here.
  1313. 48:38We got 0.92. We kind of saw that without
  1314. 48:41even doing the formula. We saw that A
  1315. 48:43and B are close. I agree, but again, as
  1316. 48:45I said, imagine you have thousands of
  1317. 48:47them and multiple not only three movies,
  1318. 48:49right? So, yes, the very high
  1319. 48:52similarity, meaning these have similar
  1320. 48:55tastes. A and B have similar tastes. So,
  1321. 48:57therefore, I'm going to make a
  1322. 48:58recommendation
  1323. 48:59I'm going to recommend to A movies that
  1324. 49:02B
  1325. 49:04you haven't watched, but B watched them,
  1326. 49:06for example. So, rated movie, for
  1327. 49:08example
  1328. 49:10The rating could be zero or haven't
  1329. 49:13watched it. That's why I did not give it
  1330. 49:15a rating yet, suppose. So, what B has
  1331. 49:17watched it, gave it a two, maybe I could
  1332. 49:20recommend it. Obviously, our example's
  1333. 49:21not a good one. I could have better
  1334. 49:23example, meaning I will also add a
  1335. 49:25column to do watch or did you
  1336. 49:26did you not watch it? But you got the
  1337. 49:28point. We figured out that A and B are
  1338. 49:30similar. Same thing applies to buying
  1339. 49:32things, advertisements that you see on
  1340. 49:35Instagram and Tik Tok that you get.
  1341. 49:38They're not magic. You got them for a
  1342. 49:40reason. Either because of you, what
  1343. 49:42you've done, an email that you got, or a
  1344. 49:45WhatsApp message, or your friends, or
  1345. 49:48people similar to you, okay? So, this is
  1346. 49:51the idea.
  1347. 49:52So, that we have a lot of challenges. Uh
  1348. 49:54biased this data privacy. You see many
  1349. 49:56of the examples I gave you,
  1350. 49:58I really kind of invaded your privacy. I
  1351. 50:00said, "Oh, I'm going to see what did you
  1352. 50:02buy a plane uh ticket? I'm going to see
  1353. 50:05how you spend your money." This is all
  1354. 50:07invasion of privacy. Who's going to
  1355. 50:09allow others to check out their credit
  1356. 50:11history, right? Or your your credit card
  1357. 50:13statement. Maybe your bank can do it.
  1358. 50:15And this is something I'm going to give
  1359. 50:17you example. Uh MasterCard was able to
  1360. 50:19do. So, yes, we have some issues. So,
  1361. 50:22biased data It could be biased like we
  1362. 50:24all always say about biasedness because
  1363. 50:27of the data that we use for training. Uh
  1364. 50:29privacy issues a lot. Overfitting, I've
  1365. 50:32talked about this before.
  1366. 50:34I mean, where my data was not good
  1367. 50:36enough and I trained it on a specific
  1368. 50:38pool of data uh
  1369. 50:40that wasn't really representative of the
  1370. 50:42whole set. So, when I want to do
  1371. 50:44prediction, my prediction would not be
  1372. 50:45good.
  1373. 50:47Market is very unpredictable as well.
  1374. 50:49So, again, if you look at ethics, so,
  1375. 50:52if I want to give you a loan, my my
  1376. 50:54algorithm could be biased, very similar
  1377. 50:55to biased in hiring. Biased towards
  1378. 50:57gender, biased towards a specific group
  1379. 51:00of people. Again, this is what we refer
  1380. 51:02to as algorithmic bias.
  1381. 51:04It could be unfair. Could deny loans.
  1382. 51:08Again, based on the data. It's not very
  1383. 51:09transparent. I've talked about
  1384. 51:11transparency before. We don't know how
  1385. 51:13the AI system is doing it.
  1386. 51:15We can't.
  1387. 51:16Uh even if we do, we won't understand
  1388. 51:18the decisions behind it. So, it could be
  1389. 51:20Again, this is an example based on where
  1390. 51:23you live.
  1391. 51:24Uh yeah, Montauk. You might get a loan
  1392. 51:26or not get a loan. So, this could be
  1393. 51:28very unfair, very biased. So, again, we
  1394. 51:32need to regulate this. So, ethics, when
  1395. 51:34it comes to AI in business and finance,
  1396. 51:35is a huge topic. It's a course on its
  1397. 51:37own. Okay?
  1398. 51:39Let's look at some a real-world
  1399. 51:41applications just to finish this
  1400. 51:42lecture. Very nice lecture. I like it
  1401. 51:44cuz it has to do with money, right? So,
  1402. 51:47if you look at
  1403. 51:48uh
  1404. 51:48JP Morgan, they used AI for legal
  1405. 51:52contracts. So, they they did uh
  1406. 51:55again, about 360,000 hours of manual
  1407. 51:58work using AI. They used NLP, document
  1408. 52:02classification. Again, you all know JP
  1409. 52:04Morgan, right? They used it for legal
  1410. 52:06documents. Uh obviously, it could go
  1411. 52:08wrong. So, we could have some issues by
  1412. 52:10misinterpret- interpreting. That's why
  1413. 52:12we still need humans, but this is a
  1414. 52:14real-world example. I always When I give
  1415. 52:16you these examples, I want to give you
  1416. 52:17something that's real. Do not make this
  1417. 52:19up. So, it was on the news. So, we have
  1418. 52:21some issues, of course, legal,
  1419. 52:23financial, or liability risks that could
  1420. 52:25happen with something like this. Again,
  1421. 52:27you can check out the video
  1422. 52:30uh JP Morgan.
  1423. 52:32Uh
  1424. 52:32again, these are some examples.
  1425. 52:35Okay, let's let's unpack this.
  1426. 52:36>> Again, this is
  1427. 52:37>> on artificial intelligence in banking,
  1428. 52:39So, this is something using um
  1429. 52:42notebook LM
  1430. 52:44created a podcast for you to see how um
  1431. 52:47AI can be used in banking and some
  1432. 52:49examples. This is nice. You could hear
  1433. 52:51listen to this, but again, I wanted to
  1434. 52:53do it
  1435. 52:55show you an example of using an AI tool
  1436. 52:57to explain AI in business. So, you can
  1437. 52:59check this out, okay?
  1438. 53:01Let me just stop this, okay?
  1439. 53:03So, AI in fraud detection,
  1440. 53:05um it could monitor
  1441. 53:07uh as I said, I already talked about
  1442. 53:09this. Real-time banking, this is already
  1443. 53:11used. So, the example we use about fraud
  1444. 53:13detection is used in many banks, top
  1445. 53:15banks. There are some breakthroughs on
  1446. 53:18the news it was.
  1447. 53:19Uh they use anomaly detections. Uh false
  1448. 53:22positive, false negatives could happen,
  1449. 53:24of course. False negative, the missed
  1450. 53:27fraud, is what we need to be aware of,
  1451. 53:29okay? Again, I put a short video
  1452. 53:32uh to see fraud in the age of AI. I'll
  1453. 53:34just show you what I mean. It's a
  1454. 53:361-minute thing about JP Morgan payments.
  1455. 53:40When AI takes over the account, access
  1456. 53:42still looks legitimate. But subtle
  1457. 53:45signals emerge. Unusual amounts, new
  1458. 53:47recipients, transactions that break
  1459. 53:50expected patterns.
  1460. 53:52In 2024, more than 1 million identity
  1461. 53:55theft cases were reported. Okay, stop
  1462. 53:57here. So, in 2024, more than 1 million
  1463. 53:59identity theft we had. Imagine. Again,
  1464. 54:03using AI, hopefully. 1 million, that's
  1465. 54:06huge. You know, people impersonating
  1466. 54:09others and stealing their identity to do
  1467. 54:11some financial stuff. Let me just stop
  1468. 54:13here. So, again, you could check this
  1469. 54:15out on your own. Um
  1470. 54:19uh as a real example. So, we could have
  1471. 54:21Oh, yeah, this is huge. AI scams and
  1472. 54:24deep fakes, this is all over the place.
  1473. 54:26I'll give you examples. So, AI
  1474. 54:29was used to impersonate executives as if
  1475. 54:33using deep fakes. Like, you're looking
  1476. 54:34at me now. Hopefully, I'm real. Uh they
  1477. 54:37had deep fakes, and they were
  1478. 54:41that led to a loss of 25 million
  1479. 54:43dollars. Again, this was on the news.
  1480. 54:46They used fake voice, fake video. Uh
  1481. 54:49they used deep learning, voice cloning.
  1482. 54:52Um you could see, AI is good.
  1483. 54:54Uh but in this case, it was used for
  1484. 54:56bad.
  1485. 54:58And I put the link there. You could read
  1486. 55:00about what's what's happened. There's a
  1487. 55:01scammers using this, of course. To fight
  1488. 55:04AI, we need to use AI. The same thing
  1489. 55:06when we we talk about security. To fight
  1490. 55:09uh thieves, you need a thief on in your
  1491. 55:12team to understand how thieves think,
  1492. 55:15right? Same thing with cybersecurity.
  1493. 55:17You know, many of the hackers ultimately
  1494. 55:20work for the FBI and CIA because they
  1495. 55:23understand how hackers think. So, same
  1496. 55:25thing here. AI that understands AI, you
  1497. 55:27know?
  1498. 55:28Uh so, we need to defend use of
  1499. 55:30multi-factor authentication, AI
  1500. 55:32detection systems, human verification as
  1501. 55:34well. Mastercard is another example
  1502. 55:38at scale I put here they're using a new
  1503. 55:41gen AI models huge processing billions
  1504. 55:45of transaction you're looking at
  1505. 55:47MasterCard to Visa and MasterCard huge
  1506. 55:50you have billions of transactions so
  1507. 55:52they claim they they they double the
  1508. 55:55fraud detection accuracy using their AI
  1509. 55:57model by the way each one have their own
  1510. 56:00AI model they don't share too much
  1511. 56:02information about it and because they're
  1512. 56:04using their data to train it to become
  1513. 56:06more smart or smarter over time they use
  1514. 56:09something called graph neural network I
  1515. 56:10mentioned it a bit when I talked about
  1516. 56:12molecules we talked about
  1517. 56:16health care AI and health care so that's
  1518. 56:18what we refer to as graph neural network
  1519. 56:20and behavior analytics how people are
  1520. 56:22behaving and this really shows the scale
  1521. 56:25of AI
  1522. 56:26going to finish this lecture what do you
  1523. 56:28think about a business AI system define
  1524. 56:32what the problem is what data you need
  1525. 56:34what model you need what risks are there
  1526. 56:36again this is a small example if we were
  1527. 56:39in class we'd do this live for you to
  1528. 56:42kind of envision this so please reflect
  1529. 56:44on this on your own so I I want to
  1530. 56:46create a new business a new startup and
  1531. 56:49let's define these what are we trying to
  1532. 56:51solve using AI what kind of data do I
  1533. 56:53need what kind of model call it a
  1534. 56:56function f of x
  1535. 56:58and these are the parameters x1 x2 x3 x4
  1536. 57:01x5 x6 and these are the what the things
  1537. 57:03I'm going to feed to the model and then
  1538. 57:05you could sit with a computer scientist
  1539. 57:06like me or anybody and say write me a
  1540. 57:09program to take these model take these
  1541. 57:11data and generate an AI model and this
  1542. 57:15could give you make you billions of
  1543. 57:16dollars if you really have a model that
  1544. 57:19has high accuracy high precision you
  1545. 57:23know high recall the things that we
  1546. 57:25already discussed before okay so yes AI
  1547. 57:28is transforming businesses decisions are
  1548. 57:31becoming data driven and really changing
  1549. 57:35everything and human oversight has to
  1550. 57:37always be there
  1551. 57:39whether we like it or not. Okay, so the
  1552. 57:41humans
  1553. 57:43are the are the core. So I'm going to
  1554. 57:45I'm going to stop sharing.
  1555. 57:47Okay, so
  1556. 57:49thank you so much. I hope you enjoyed
  1557. 57:51this lecture as much as I did and I will
  1558. 57:53see you in the next lecture. Take care.

About this transcript

This page contains the full transcript of AI in Business and Finance by Mohamed Watfa, generated from the public captions YouTube serves with the video. The transcript has 10,193 words across 1,558 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.