TensorFlow เฟรมเวิร์ก ML จาก Google Open Source ใช้กับ Python อัลกอริทึม Deep Learning งานวิจัยและ Production
ติดตั้ง tensorflow บน Windows:
pip install tensorflow
Tensor โครงสร้างข้อมูลใน TensorFlow (Data Flow Graph) เป็นอาร์เรย์หลายมิติ/ลิสต์ มี 3 แอตทริบิวต์: Rank, Type, Shape
Keras พัฒนาขึ้นในโครงการ ONEIROS เป็น Deep Learning API เขียนด้วย Python High-level API ใช้งานง่าย รันบน TensorFlow ช่วยทดลองเร็ว มี Abstraction และ Building Blocks สำคัญสำหรับ ML Solutions
ใช้ Google Colab รันโค้ด (Python บนเบราว์เซอร์ ฟรี GPU บน Jupyter Notebook)
ตัวอย่าง
print("The two models are compared")
print("Linear model on binary vectorized data:")
print(binary_model.summary())
print("ConvNet model on int vectorized data:")
print(int_model.summary())
Credit: TensorFlow Tutorials
ผลลัพธ์
The two models are compared Linear model on binary vectorized data: Model: "sequential" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= dense (Dense) (None, 4) 40004 ================================================================= Total params: 40,004 Trainable params: 40,004 Non-trainable params: 0 _________________________________________________________________ None ConvNet model on int vectorized data: Model: "sequential_1" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= embedding (Embedding) (None, None, 64) 640064 conv1d (Conv1D) (None, None, 64) 20544 global_max_pooling1d (Global (None, 64) 0 dense_1 (Dense) (None, 4) 260 ================================================================= Total params: 660,868 Trainable params: 660,868 Non-trainable params: 0 _________________________________________________________________ None
คำอธิบาย
เปรียบเทียบโมเดล Binary Vectorized และ Int Vectorized
แสดงเปรียบเทียบผ่านเมธอด
summaryบน Console