<jupyter_start><jupyter_text>TF is quite low level language - all operations you need to definw by yourselfExample:Definition of variable in TF is tf.VariableIf you want to build cost function - you need to specify it by every single operation here:```y = w*w - 10*w + 25```<jupyter_code>w = tf.Variable(0,dtype=tf.float32)
cost = tf.add(tf.add(w**2, tf.multiply(-10.,w)),25)

#learning_rate 0.01
train = tf.train.GradientDescentOptimizer(0.01).minimize(cost)

# initialize global variables and start session
init=tf.global_variables_initializer()
session = tf.Session()
session.run(init)

# really  nothing yet - just evaluate W
print(session.run(w))<jupyter_output><empty_output><jupyter_text>finally we run training<jupyter_code>session.run(train)
print(session.run(w))<jupyter_output><empty_output><jupyter_text>but that was just one iteration ... we need to run it for some time in loop!<jupyter_code>for i in range(1000):
    session.run(train)
print(session.run(w))<jupyter_output><empty_output><jupyter_text>as our cost function is  realy `(w-5)^2` output should be close to 5.0 And now lets try with input data<jupyter_code>coefficients = np.array([[1.],[-10.],[25.]])

w = tf.Variable(0,dtype=tf.float32)
x = tf.placeholder(tf.float32,[3,1])
cost = x[0][0]*w**2 +x[1][0]*w + x[2][0]

#learning_rate 0.01
train = tf.train.GradientDescentOptimizer(0.01).minimize(cost)

# initialize global variables and start session
init=tf.global_variables_initializer()


# more clean - python way
with tf.Session() as session:
    session.run(init)
    for i in range(1000):
        session.run(train, feed_dict = {x:coefficients})
    print(session.run(w))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1354723707664884, 'fraction_numerical': 0.032679738562091505, 'mean_word_length': 5.709163346613546, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '438342', 'license': 'Apache-2.0', 'n_tokens_mistral': 625, 'n_tokens_neox': 591, 'n_words': 144, 'path': 'LESSONS/10_TensorFlow/FirstBlood.ipynb', 'repo_name': 'yarenty/ML_SurvivalGuide', 'size': '1683'}