Posts

ทดลอง Machine Learning XGBoost กับ Bitcoin บนทฤษฎี Market Profile (ตอนที่ 1)

Image
ในช่วงก่อนวันหยุดยาว Bitcoin ทำ new high ไม่หยุดจนทะลุ 106,000 ดอลลาร์ต่อ 1 BTC  ในวันที่ 17 ธันวาคม 2567 ยังไม่ทันได้ดีใจ ก็ลดลงฮวบฮาบจนต่ำกว่า 95,000 ดอลลาร์  หรือลงมากกว่า 10% ภายใน 8 วัน คำถามจึงเกิดขึ้นว่า เป็นไปได้ไหมว่าเราจะขาย BTC ใกล้จุดสูงสุด?  และที่สำคัญ เป็นไปได้ไหมว่าเราจะซื้อ BTC ใกล้จุดต่ำสุด  ก่อนที่จะขึ้นต่อ? 🤔 ผมได้มีโอกาสอ่านบทความเกี่ยวกับทฤษฎี Market Profile ซึ่งหลังจากทำความเข้าใจแล้ว ผมรู้สึกว่าทฤษฎีนี้มีเหตุผลรองรับดี และถ้าเจอ pattern ที่ผู้เขียนทฤษฎีพูดไว้ ก็สามารถทำนายได้ว่า ตลาดจะวิ่งต่อไปในทิศทางใด  ไม่ว่าจะเป็น uptrend, downtrend  หรือ consolidate ซึ่งหมายความว่า ถ้าเป็น uptrend เราก็ซื้อ  ถ้า เป็น downtrend เราก็ขาย  หรือถ้า เป็น consolidation เราก็ถือหรือปล่อยตามความไหว ของเราว่าจะลุ้นแบบหัวใจเต้นแรง ๆ หรือไม่! 💹 ทฤษฎีนี้เดิมทีถูกนำมาใช้กับ asset ที่มีการซื้อขายเป็นช่วงเวลา มีเวลาตลาดเปิดและปิด ไม่เหมือนกับ digital asset ที่สามารถซื้อขายได้ 24 ชั่วโมงทุกวัน  แม้ว่าทฤษฎีนี้จะสังเกตอยู่กับ asset ที่แตกต่างจ...

หนี้ครัวเรือน: ภัยเงียบ ที่กำลังกัดกินเศรษฐกิจไทย

Image
 วิกฤตหนี้ครัวเรือนไทยกำลังทวีความรุนแรง  สะท้อนจากยอดผลิตและขายรถยนต์ที่ตกต่ำอย่างหนัก  หนี้เสียในกลุ่มสินเชื่อยานยนต์พุ่งสูง  และธนาคารเข้มงวดในการปล่อยสินเชื่อ  สถานการณ์นี้จุดชนวนความขัดแย้งเชิงนโยบาย  ระหว่างรัฐบาล  กับ  ธนาคารแห่งประเทศไทย  (ธปท.)  บทความนี้จะวิเคราะห์สถานการณ์ปัจจุบัน  สาเหตุของปัญหา  มุมมองในการแก้ไขปัญหาที่ต่างกัน  และข้อเสนอแนะจากผู้เชี่ยวชาญ  เพื่อนำไปสู่การแก้ปัญหาอย่างยั่งยืน สถานการณ์ปัจจุบัน: เสียงเตือนภัยจากอุตสาหกรรมยานยนต์ ยอดผลิตและขายรถยนต์ในไทยกำลังเผชิญกับวิกฤตที่รุนแรงที่สุดในรอบ 10 ปี  ยอดขายรถยนต์ในประเทศลดลงอย่างต่อเนื่อง  สะท้อนถึงกำลังซื้อของประชาชนที่อ่อนแอ  สาเหตุสำคัญมาจากหนี้ครัวเรือนที่พุ่งสูงขึ้น  ทำให้ประชาชนไม่มีเงินเหลือที่จะซื้อรถยนต์  ธนาคารและไฟแนนซ์ก็เข้มงวดในการปล่อยสินเชื่อ  กลัวว่าลูกค้าจะผิดนัดชำระหนี้   สาเหตุของปัญหา: โครงสร้างหนี้ที่ไม่สร้างรายได้ ปัญหาหนี้ครัวเรือนไทยไม่ใช่เรื่องใหม่  แต่กำลังทวีความรุนแรงขึ้น ...

รถไฟฟ้าไทย: เกมการเมืองหรืออนาคตที่ยั่งยืน?

Image
  การยุติการผลิตของซูซูกิในไทยสะท้อนถึงความเปลี่ยนแปลงที่เกิดขึ้นในอุตสาหกรรมยานยนต์ ไม่ใช่แค่ในไทย แต่ทั่วโลก ซูซูกิประกาศแผนกลยุทธ์ FY2030 ที่เน้นความเป็นกลางทางคาร์บอนและการเติบโตในตลาดเกิดใหม่ เช่น อินเดีย และ แอฟริกา ซึ่งสอดคล้องกับนโยบายไทยที่มุ่งสู่การเป็นศูนย์กลาง EV ในภูมิภาค อย่างไรก็ตาม การที่ซูซูกิไม่ได้มีไทยเป็น strategic country ในแผน สะท้อนถึงปัญหาที่ซับซ้อน และอาจไม่ใช่เพียงเรื่องของเทคโนโลยีหรือการตลาดเท่านั้น เกมการเมืองที่ซับซ้อน การแข่งขันที่ไม่เท่าเทียม:  จีนได้สิทธิประโยชน์ทางภาษีนำเข้า 0% จากข้อตกลงเขตการค้าเสรี ซึ่งครอบคลุมรถยนต์ด้วย ทำให้ผู้ผลิตรถยนต์จีนมีความได้เปรียบในการแข่งขันในตลาดมากกว่าประเทศอื่น ๆ ซึ่งรวมถึงญี่ปุ่นด้วย สถานการณ์นี้ทำให้ผู้ผลิตรถยนต์จากประเทศอื่น ๆ ต้องเผชิญกับความยากลำบากในการเข้าสู่ตลาดไทย และส่งผลกระทบต่อการพัฒนาอุตสาหกรรมยานยนต์ไฟฟ้าในประเทศไทย นโยบายที่ไม่สอดคล้อง:  นโยบายของไทยอาจไม่สอดคล้องกับแผนกลยุทธ์ FY2030 ของซูซูกิอย่างสมบูรณ์ เช่น การเน้นการลงทุนในประเทศเกิดใหม่หรือการมุ่งสู่การผลิตรถยนต์ไฟฟ้าขนาดเล็ก ซึ่งอาจไม...

Enhancing Retrieval-Augmented Generation (RAG) for Thai Content with Semantic Chunking

Image
In my previous post,  "Experimenting with Retrieval-Augmented Generation (RAG) for Thai Content" , I noticed that the content stored in a vector database was chunked by the  SentenceTokenSplitter , which created many small content pieces. The meaning of each piece of content was very limited, and most of the time, the search results from the vector database were not thorough. Consequently, the responses from the RAG-LLM were not as expected. To address this, I researched different chunking strategies and found  this insightful article . After reading through, I felt that semantic chunking made more sense. It groups content into semantically close sentences instead of many single sentences. Additionally, the results from the  SentenceTokenSplitter  did not maintain their integrity, often losing important white spaces. Therefore, I decided to replace the  SentenceTokenSplitter  with  sent_tokenize  from  pythainlp  and t...

Experimenting with Retrieval-Augmented Generation (RAG) for Thai Content

Image
Welcome back to my blog! In my latest Generative AI experiment, I delved into the exciting world of Retrieval-Augmented Generation (RAG). This time, I aimed to test how well an LLM could process and understand Thai content extracted from a PDF document. Here's a step-by-step breakdown of my experiment and how you can replicate it. Objectives Load and process a PDF document containing Thai content. Vectorize the document and store the embeddings in Qdrant. Query the document and interact with the LLM to receive responses in Thai. Tools and Libraries For this experiment, I used the following tools and libraries: LangChain Community Document Loaders : To load and split the PDF document. HuggingFace Embeddings : For generating embeddings from the document content. Qdrant : As the vector database to store the document embeddings. ChatOpenAI : To interact with the LLM and generate responses. Gradio : For creating a user-friendly interface to upload PDFs and chat with the LL...

Optimizing Our Quranic Text Retrieval System with GPU Power

Image
In one of my previous posts, we dived into building a Quranic Text Retrieval System using Generative AI. It was quite a journey, but we noticed that computing embeddings for our large dataset was a bit slow, even with Ray for parallelism. So, we went on a little adventure to find a better way. Spoiler alert: we found it! 🎉 After some research, we discovered that using a GPU to compute the embeddings could significantly speed things up. Here’s how we did it. First, we initialized Ray and specified our available CPU and GPU resources: # Initialize Ray, specifying GPU resources ray.init(num_cpus=4, num_gpus=1) # Adjust based on your available GPUs This line tells Ray we have 4 CPUs and 1 GPU to work with. Next, we loaded the model and set up remote functions to use the GPU: # Load the model once and use it in remote functions model_name = 'paraphrase-multilingual-mpnet-base-v2' model = SentenceTransformer(model_name) @ray.remote(num_gpus=1) class EmbeddingWor...

Building a Quranic Text Retrieval System with Generative AI

Image
In this blog post, I will walk you through my recent experiment involving the creation of a Quranic text retrieval system using generative AI. This project leverages various technologies, including Gradio for the web interface, Qdrant for the vector database, and LM Studio as the local LLM server. Project Overview The goal of this experiment was to build a system that can store and retrieve Quranic verses based on semantic similarity. The core components of this system include: Data Loading and Preprocessing : Loading Quranic verses and their translations from a JSON file. Vectorization : Converting text into vector embeddings using a pre-trained model. Storage : Storing these embeddings in a vector database (Qdrant). Retrieval : Retrieving the most semantically similar verses based on user queries. Interactive Interface : Using Gradio to create an interactive interface for vectorizing data and querying the database. Step-by-Step Code Explanation Let's dive into the c...