title: Python. How to import my own dataset to "k means" algorithm
body: <p>I want to import my own data (sentences which are located in a .txt file) into this example algorithm, which can be found at: <a href="https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html" rel="nofollow noreferrer">https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html</a> </p>
  
  <p>The problem is that this code uses a <strong>make_blobs</strong> dataset and i have a hard time understanding how to replace it with data from .txt file.</p>
  
  <p>All I predict is that I need to replace this piece of code right here:</p>
  
  <pre><code>X, y = make_blobs(n_samples=500,
            n_features=2,
            centers=4,
            cluster_std=1,
            center_box=(-10.0, 10.0),
            shuffle=True,
            random_state=1)  # For reproducibility
  </code></pre>
  
  <p>Also I do not understand these variables <strong>X, y</strong> . I assume that <strong>X</strong> is an array of data, and what about <strong>y</strong>? </p>
  
  <p>Should I just assign everything to the X as like this and that example code would work? But what about those <strong>make_blobs</strong> features like centers, n_features etc.? Do I need to specify them somehow differently?</p>
  
  <pre><code># open and read from the txt file
  path = "C:/Users/user/Desktop/sentences.txt"
  file = open(path, 'r')
  # assign it to the X
  X = file.readlines() 
  </code></pre>
  
  <p>Any help is appreciated!</p>