When scale the data, why the train dataset use 'fit' and 'transform', but the test dataset only use 'transform'? : <p>When scale the data, why the train dataset use 'fit' and 'transform', but the test dataset only use 'transform'?</p>

<pre><code>SAMPLE_COUNT = 5000
TEST_COUNT = 20000
seed(0)
sample = list()
test_sample = list()
for index, line in enumerate(open('covtype.data','rb')):
    if index &lt; SAMPLE_COUNT:
        sample.append(line)
    else:
        r = randint(0,index)
        if r &lt; SAMPLE_COUNT:
            sample[r] = line
        else:
            k = randint(0,index)
            if k &lt; TEST_COUNT:
                if len(test_sample) &lt; TEST_COUNT:
                    test_sample.append(line)
                else:
                    test_sample[k] = line
from sklearn.preprocessing import StandardScaler
for n, line in enumerate(sample):
sample[n] = map(float, line.strip().split(','))
y = np.array(sample)[:,-1]
scaling = StandardScaler()

X = scaling.fit_transform(np.array(sample)[:,:-1]) ##here use fit and transform

for n,line in enumerate(test_sample):
test_sample[n] = map(float,line.strip().split(','))
yt = np.array(test_sample)[:,-1]

Xt = scaling.transform(np.array(test_sample)[:,:-1])##why here only use transform
</code></pre>

<p>As the annotation says, why Xt only use transform but no fit?</p>
