{
  "source_file": "0930",
  "source_platform": "Hashnode",
  "author": "Tharun",
  "title_listed": "What Is a Vector? The Building Block Behind Every Machine Learning Model",
  "keywords": "",
  "domain": "机器学习",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://tharunpandya.hashnode.dev/what-is-a-vector-in-machine-learning",
  "publish_date": "2026-07-08",
  "corpus_stage": "",
  "notes": "",
  "id": "9c25f4f24ef0",
  "collected_at": "2026-10-02T14:10:46",
  "title": "What Is a Vector in Machine Learning?",
  "body_markdown": "What Is a Vector? The Building Block Behind Every Machine Learning Model\nUpdated\nJuly 8, 2026\n•\n10\nmin read\n•\nView as Markdown\nT\nTharun\n\"The word vector scared me more than Linear Algebra itself. I thought it was some advanced mathematical concept. It turned out I'd been working with vectors long before I even knew what they were.\"\nHave You Ever Wondered Why Everyone Talks About Vectors?\nIn my previous article, I talked about why I decided to learn Linear Algebra before diving deep into Machine Learning. When reading about the subject, I noticed something interesting. No matter which topic I explored—Linear Regression, Neural Networks, Computer Vision, or even Large Language Models—the same word kept appearing.\nVector.\nAt first, I ignored it.\nI assumed it was one of those mathematical terms that would make sense later. My plan was simple: learn the basics first and come back to vectors once I felt more confident.\nBut the more I learned, the more I realized that wasn't going to work.\nAlmost every Machine Learning algorithm begins with vectors. Research papers mention feature vectors. Tutorials talk about vector operations. Recommendation systems compare vectors. Even ChatGPT converts words into vectors before understanding them.\nAfter seeing the same concept everywhere, I became curious. If vectors are so important, why not understand them now instead of postponing them?\nSo I spent a few days learning what a vector actually is.\nThe funny part is that after all that reading, I couldn't help but laugh.\nThe concept wasn't difficult at all.\nThe name made it sound much scarier than it really is.\nIt All Starts With a Simple Question\nBefore talking about vectors, let's think about something much simpler.\nImagine someone asks you to describe yourself using only numbers.\nYou might say you're 22 years old, 172 centimeters tall, and weigh 68 kilograms.\nThose three numbers already tell us quite a bit about you. They don't describe your personality, your interests, or your experiences, but they do describe some measurable characteristics.\nNow imagine writing those values together like this:\n[22, 172, 68]\nBelieve it or not, that's a vector.\nThat's all a vector really is.\nIt's simply an ordered collection of related numbers.\nNothing more.\nWhen I first discovered this, I wondered why textbooks made it sound so complicated. The mathematical notation looked intimidating, but the underlying idea was something I'd already been using in programming without realizing it.\nWhy Not Store Everything Separately?\nThat was the first question that came to my mind.\nIf we already have variables in programming, why do we even need vectors?\nAfter all, writing something like this seems perfectly reasonable.\nage = 22\nheight = 172\nweight = 68\nFor a small program, there's absolutely nothing wrong with this approach.\nBut Machine Learning doesn't usually deal with one person or one object.\nImagine you're building a model using data from one hundred thousand people. Every person has dozens of features such as age, height, weight, income, education, years of experience, and many more.\nWould you create separate variables for every single value?\nOf course not.\nIt would quickly become impossible to manage.\nInstead, we group all the information describing one person into a single collection.\nA person who is 22 years old, 172 centimeters tall, and weighs 68 kilograms can simply be represented as\n[22, 172, 68]\n.\nAnother person might become\n[18, 165, 55]\n.\nSomeone else might be represented as\n[31, 180, 75]\n.\nInstead of dealing with dozens of independent variables, every person is now represented by a single vector.\nThis makes the data much easier to organize, process, and analyze.\nMore importantly, it's exactly how Machine Learning models expect data to be presented.\nHow Does This Help in Machine Learning?\nLet's imagine we're building a model that predicts house prices.\nAs humans, we naturally describe a house using words.\nWe might say it has three bedrooms, two bathrooms, 1,800 square feet of living space, and that it was built five years ago.\nA computer, however, doesn't understand words like\nbedroom\nor\nbathroom\n.\nIt only understands numbers.\nSo instead of storing the information as sentences, we convert everything into numerical values.\nThe same house can now be represented as:\n[3, 2, 1800, 5]\nEach number represents one feature of the house.\nThree bedrooms.\nTwo bathrooms.\nOne thousand eight hundred square feet.\nFive years old.\nNow imagine repeating this process for ten thousand different houses.\nEvery house becomes one vector.\nTogether, those vectors become the dataset that the Machine Learning model learns from.\nThis was one of those moments where everything started making sense to me.\nI had always wondered what people meant when they said that Machine Learning models \"learn from data.\"\nNow I realized that, in reality, the model isn't learning from houses, students, customers, or images.\nIt's learning from vectors.\nEvery real-world object is first converted into numbers, and those numbers are grouped together into vectors before the algorithm ever sees them.\nCreating Your First Vector in Python\nBy this point, you already know what a vector is. The good news is that creating one in Python is just as simple as understanding the concept itself.\nIf you've been learning Python, you've probably heard of\nNumPy\n, one of the most popular libraries for scientific computing and Machine Learning. NumPy provides a data structure called an array, which is how vectors are commonly represented in Python.\nHere's a simple example:\nimport numpy as np\n\nstudent = np.array([22, 172, 68])\n\nprint(student)\nThe output is:\n[22 172 68]\nAt first glance, this doesn't look very different from a regular Python list. That's because both store values in a sequence. The real difference appears when we start performing mathematical operations.\nWe can also access each value using its position, just like we do with lists.\nprint(student[0])\nprint(student[1])\nprint(student[2])\nThis gives the following output:\n22\n172\n68\nThe first value represents the student's age, the second represents height, and the third represents weight. Whether your vector contains three values or three thousand, the idea remains exactly the same.\nIs a Python List Also a Vector?\nThis was one of the questions that confused me the most.\nIf both NumPy arrays and Python lists look almost identical, why do Machine Learning engineers always recommend using NumPy?\nFor example, we can store the same information using a normal list.\nstudent = [22, 172, 68]\nNothing looks different.\nIn fact, if your goal is simply to store values, a Python list works perfectly well.\nThe difference becomes obvious when mathematics enters the picture.\nLet's create two NumPy arrays.\nimport numpy as np\n\na = np.array([1, 2, 3])\nb = np.array([4, 5, 6])\n\nprint(a + b)\nThe output is:\n[5 7 9]\nInstead of joining the arrays together, NumPy adds the corresponding elements one by one. The first value is added to the first value, the second to the second, and the third to the third.\nNow let's try exactly the same thing using regular Python lists.\na = [1, 2, 3]\nb = [4, 5, 6]\n\nprint(a + b)\nThis time the output is completely different.\n[1, 2, 3, 4, 5, 6]\nPython doesn't perform addition here. It simply combines the two lists into one larger list.\nWhen I saw this for the first time, I finally understood why Machine Learning libraries depend so heavily on NumPy. Algorithms constantly perform mathematical operations on vectors, and NumPy is built specifically for that purpose.\nOnce You Understand Vectors, You'll See Them Everywhere\nOne of the most interesting things happened after I understood what a vector was.\nI started noticing vectors in almost every AI application I used.\nTake Spotify, for example.\nWhen you listen to a song, Spotify isn't just looking at its title or artist. Every song is represented using numerical features such as tempo, danceability, energy, loudness, acousticness, and many other characteristics. Together, those numbers form a vector. When Spotify recommends similar songs, it's actually comparing these vectors to measure how similar two songs are.\nNetflix works in a similar way.\nInstead of thinking of a movie as simply an action film or a comedy, Netflix represents every movie using numerical information such as genre, runtime, popularity, user ratings, release year, and many other features. Recommendation algorithms compare these vectors to suggest movies you might enjoy watching next.\nFace recognition is another great example.\nWhen you unlock your phone using your face, your device isn't comparing photographs pixel by pixel. Instead, it converts your facial features into a long vector containing hundreds of numerical values. Every time you look at your phone, it creates another vector and compares it with the one stored during setup. If the vectors are similar enough, your phone unlocks.\nThen there's ChatGPT.\nThis example fascinated me the most.\nWhen we type a sentence like:\n\"Machine Learning is fun.\"\nthe model doesn't immediately understand those words the way humans do.\nBefore any processing begins, every word is converted into a numerical representation known as an\nembedding vector\n.\nThe model doesn't think in English.\nIt thinks in numbers.\nThat realization completely changed the way I look at Artificial Intelligence.\nNo matter whether it's text, music, images, videos, or recommendations, almost everything eventually becomes a collection of vectors.\nWhy Machine Learning Loves Vectors\nAs I continued learning, I realized that vectors aren't just another topic in Linear Algebra.\nThey are the standard way computers represent data.\nThink about almost any Machine Learning problem.\nA customer can be represented by age, income, and purchase history.\nA student can be represented by marks, attendance, and study hours.\nA house can be represented by bedrooms, bathrooms, area, and age.\nAn image can be represented by millions of pixel values.\nEven a sentence can be represented by numerical embeddings.\nAlthough these examples seem completely different, they all follow exactly the same idea.\nTake a real-world object.\nConvert its characteristics into numbers.\nGroup those numbers together.\nThe result is a vector.\nThat's why you'll often hear phrases like\nfeature vector\nwhile learning Machine Learning.\nWhen I first heard that term, it sounded incredibly technical.\nNow it feels surprisingly simple.\nA feature vector is nothing more than the list of numbers that describes one piece of data.\nOnce I understood this idea, reading Machine Learning tutorials became much easier because I finally knew what people meant when they talked about feeding vectors into a model.\nWhat's Next?\nNow we've answered one important question.\nHow do we represent a single object?\nThe answer is simple.\nWe use a vector.\nBut Machine Learning models don't train on one student, one customer, or one house.\nThey learn from thousands or even millions of them.\nSo another question naturally follows.\nHow do we organize millions of vectors together?\nThat's where the next building block of Linear Algebra comes in.\nMatrices.\nIn the next article, we'll learn what a matrix is, how it's different from a vector, and why almost every Machine Learning dataset is stored as a matrix before training begins.\n#\nmachine-learning\n#\nvectors\n#\nlinear-algebra\n#\ndeeplearning\n#\nai\n#\nartificial-intelligence\n#\npython\n#\nnumpy\n#\ndata-science\n#\nmathematics\n21\nviews",
  "metadata": {
    "title": "What Is a Vector in Machine Learning?",
    "description": "Learn what vectors are, why they matter in Machine Learning, and how they help computers represent and process real-world data.",
    "keywords": null,
    "author": null,
    "og:title": "What Is a Vector in Machine Learning?",
    "og:description": "Learn what vectors are, why they matter in Machine Learning, and how they help computers represent and process real-world data.",
    "og:url": "https://tharunpandya.hashnode.dev/what-is-a-vector-in-machine-learning",
    "og:site_name": "Machine Learing From scratch",
    "og:image": "https://cdn.hashnode.com/uploads/og-images/6a3f9a25a837e83b51cc8712/233c5b7a-2bfb-4671-9f4f-3ca5eb82e64e.png",
    "og:image:width": "1200",
    "og:image:height": "630",
    "og:type": "article",
    "twitter:card": "summary_large_image",
    "twitter:title": "What Is a Vector in Machine Learning?",
    "twitter:description": "Learn what vectors are, why they matter in Machine Learning, and how they help computers represent and process real-world data.",
    "twitter:image": "https://cdn.hashnode.com/uploads/og-images/6a3f9a25a837e83b51cc8712/233c5b7a-2bfb-4671-9f4f-3ca5eb82e64e.png",
    "article:published_time": "2026-07-08T12:28:35.894Z",
    "article:modified_time": "2026-07-08T12:28:35.894Z",
    "article:author": "https://tharunpandya.hashnode.dev/@tharun-pandya"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/9c25f4f24ef0/code/body-000.txt",
      "chars": 34,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-001.txt",
      "chars": 70,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-002.txt",
      "chars": 12,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-003.txt",
      "chars": 54,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-004.txt",
      "chars": 10,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-005.txt",
      "chars": 24,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-006.txt",
      "chars": 82,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-007.txt",
      "chars": 8,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-008.txt",
      "chars": 42,
      "language": "text"
    },
    {
      "file": "attachments/9c25f4f24ef0/code/body-009.txt",
      "chars": 19,
      "language": "text"
    }
  ],
  "images": [
    {
      "status": "ok",
      "url": "https://cdn.hashnode.com/uploads/covers/6a3f9a25a837e83b51cc8712/849da543-d9f1-4450-b51a-4027dcc70d7b.png",
      "bytes": 1196055,
      "reused": true,
      "local_path": "attachments/9c25f4f24ef0/images/002.png",
      "src": "https://cdn.hashnode.com/uploads/covers/6a3f9a25a837e83b51cc8712/849da543-d9f1-4450-b51a-4027dcc70d7b.png",
      "alt": "What Is a Vector? The Building Block Behind Every Machine Learning Model",
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [
    {
      "href": "https://tharunpandya.hashnode.dev/what-is-a-vector-in-machine-learning.md",
      "label": "View as Markdown",
      "type": "a"
    },
    {
      "href": "https://hashnode.com/@tharun-pandya",
      "label": "T",
      "type": "a"
    },
    {
      "href": "https://linkedin.com/in/tharun-pandya-kodi",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/machine-learning",
      "label": "# machine-learning",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/vectors",
      "label": "# vectors",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/linear-algebra",
      "label": "# linear-algebra",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/deeplearning",
      "label": "# deeplearning",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/ai",
      "label": "# ai",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/artificial-intelligence",
      "label": "# artificial-intelligence",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/python",
      "label": "# python",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/numpy",
      "label": "# numpy",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/data-science",
      "label": "# data-science",
      "type": "a"
    },
    {
      "href": "https://tharunpandya.hashnode.dev/tag/mathematics",
      "label": "# mathematics",
      "type": "a"
    }
  ],
  "retry_at": "2026-10-03T08:05:15",
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:50:30Z",
  "source_url": "https://tharunpandya.hashnode.dev/what-is-a-vector-in-machine-learning",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 11471,
  "expected_body_images": 1,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/9c25f4f24ef0/pages/source.html",
  "local_html": "attachments/9c25f4f24ef0/pages/article.html",
  "body_base_path": "attachments/9c25f4f24ef0/pages/",
  "body_markdown_path": "attachments/9c25f4f24ef0/pages/article.md"
}