Trang báo cáo tổng hợp cho Assignment 1 - phần phân loại văn bản bất động sản. Bài toán sử dụng phần mô tả quảng cáo
để dự đoán nhóm bất động sản, kết hợp EDA, tiền xử lý text, huấn luyện mô hình và trực quan hóa kết quả đánh giá.
Bài toán là phân loại văn bản mô tả bất động sản thành 6 nhóm `type` dựa trên nội dung quảng cáo của mỗi bất đống sản.
Đầu vào của mô hình là chuỗi mô tả text đã được làm sạch, còn đầu ra là nhãn lớp thuộc một trong sáu loại:
condos, farm, land, multi_family, single_family và townhomes.
Mục tiêu của bài toán là khai thác tín hiệu ngôn ngữ trong phần mô tả để dự đoán đúng nhóm bất động sản,
đánh giá mô hình bằng Accuracy, Macro F1 và Weighted F1, đồng thời kiểm tra ảnh hưởng của tiền xử lý text, cách biểu diễn
đặc trưng và lựa chọn mô hình phân loại.
Bài toán
Text Multi-class Classification
Số lớp
6 classes
Metrics
Macro F1 + Accuracy + Weighted F1
Số cấu hình chạy
13 experiments
02
EDA (Exploratory Data Analysis)
Trực quan hóa phân bố mẫu theo lớp và khảo sát các đặc trưng text trước bước tiền xử lý để kiểm tra chất lượng dữ liệu.
Kích thước dataset: 10403 đoạn mô tả - 8 lớp
Phân bố số lượng mẫu theo từng lớp.
Text Samples (compact view)
Samples for Class: single_family
Sample 1: Showings subject to accepted offer. Investor opportunity in Cathedral Park...
Sample 2: *DO NOT DRIVE BY WITHOUT AN APPOINTMENT* Distressed property due to land movement...
Samples for Class: condos
Sample 1: This exceptional property is priced to sell and is a must-see for fly fishing enthusiasts...
Sample 2: Sophisticated and beautifully updated riverfront townhome in an exceptional location...
Samples for Class: land, farm, multi_family, townhome, unknown, townhomes
Nội dung đầy đủ rất dài, đã được đặt trong popup để dễ đọc hơn.
02.1
Tiền xử lý text
Dữ liệu text được chuẩn hóa theo hai chế độ để phục vụ so sánh thực nghiệm. Cách Minimal giữ lại tối đa cấu trúc gốc của mô tả,
chỉ đưa về chữ thường và chuẩn hóa khoảng trắng. Cách Aggressive đi xa hơn bằng việc loại bỏ ký tự không phải chữ/số,
tách token và loại stopwords để giảm nhiễu từ các mô tả bất động sản dài, lặp ý và nhiều ký tự trang trí.
Minimal
Mục tiêu
Giữ ngữ nghĩa gần với văn bản gốc nhất có thể, phù hợp khi muốn bảo toàn tín hiệu mô tả, tên riêng,
cụm từ chỉ vị trí và các chi tiết quan trọng trong listing.
Phân bố độ dài text sau tiền xử lý.Độ dài văn bản theo từng class.
Aggressive
Mục tiêu
Tập trung vào các token mang tính phân biệt cao, giảm nhiễu từ dấu câu và stopwords để hỗ trợ mô hình
học rõ hơn những cụm từ quan trọng cho từng loại bất động sản.
Top 5 word xuất hiện nhiều nhất theo class.
Nhận xét thực nghiệm
Minimal phù hợp khi cần giữ nguyên nhiều tín hiệu mô tả tự nhiên của listing. Aggressive hữu ích khi muốn
làm gọn không gian từ vựng và nhấn mạnh từ khóa đặc trưng cho từng lớp.
03
Cách chia Data Split và Data Augmentation
Dữ liệu được chia theo tỉ lệ 80/10/10 để đảm bảo phân phối lớp ổn định giữa train/val/test.
Cách chia này giúp tập huấn luyện có đủ dữ liệu để học đặc trưng văn bản, đồng thời vẫn giữ được tập val/test
cân bằng để đánh giá khách quan.
Train
8302 rows
Validation
1038 rows
Test
1038 rows
Split ratio
80 / 10 / 10
Phân bố class theo từng split (%)
type
train_%
val_%
test_%
single_family
63.07
63.01
63.10
land
18.00
18.02
18.02
condos
8.26
8.29
8.29
townhomes
4.85
4.91
4.82
multi_family
3.96
3.95
3.95
farm
1.85
1.83
1.83
Data augmentation cho tập train được thực hiện bằng back translation để tạo thêm sample (tăng tính đa dạng) cho các class
farm, multi_family, townhomes và condos. Mục tiêu là tạo thêm
các biến thể diễn đạt mà vẫn giữ nguyên nhãn, đặc biệt hữu ích cho những lớp có số lượng mẫu thấp hơn.
04
Lựa chọn mô hình Backbone (3 loại)
So sánh ba kiến trúc chính cho bài toán phân loại văn bản: BiLSTM, BERT base và DistillBert.
BiLSTMRNN-based
Kiến trúc BiLSTM cho phân loại text.
BERT base + DistillBertTransformer-based
So sánh kiến trúc BERT base và DistillBert.
BiLSTM đại diện cho nhóm mô hình tuần tự nhẹ, trong khi BERT base và DistillBert đại diện cho nhóm Transformer
với khả năng nắm bắt ngữ cảnh mạnh hơn. DistillBert được dùng như lựa chọn cân bằng giữa hiệu năng và chi phí tính toán.
05
Kết quả Training (Wandb log)
Chuyển tab để xem các nhóm biểu đồ train/val theo metric.
Kết quả thực nghiệm: Giải thích dự đoán trên từng ví dụ
Mục này trình bày các ví dụ cụ thể để phân tích hành vi mô hình. Bên dưới là Ví dụ 1 cùng trực quan hóa của top-3 cấu hình.
Ví dụ 1
Ground Truth Label: Townhomes
Newly Available Owner Occupied Opportunity in Cimmaron Terrace. Beautiful 3 bedroom & 2.5 bath newer townhome has a one car garage. Open kitchen with stainless steel appliances. Laminate floors throughout kitchen, dining and living area. Walk in closet. Beautifully landscaped. Home Warranty. Appointment only.
Top 1 - BERT Full Fine-tune (Minimal + Augmented)
Top 2 - DistilBERT Full Fine-tune (Minimal + Standard)
Top 3 - DistilBERT Full Fine-tune (Minimal + Augmented)
Ví dụ 2
Ground Truth Label: Townhomes
Dream property! Whether you are an investor who wants to buy all four units, or a Buyer looking for a great home, take a look at these brand new 2 bed/2 bath homes! With all new appliances, spacious 1 car garages, and bathroom/bedroom combos on both the main and 2nd floor, this is the perfect fit for investors or families looking for a home to fit their current needs. Located close to shopping & other amenities, Park Springs is a great place to call home.
Ghi chú: cấu hình BERT Full Fine-tune (Minimal + Augmented) dự đoán sai ở ví dụ này.
BERT Full Fine-tune (Minimal + Augmented) - Mixed Case
DistilBERT Full Fine-tune (Minimal + Augmented) - Mixed Case
DistilBERT Full Fine-tune (Minimal + Standard) - Mixed Case
Ví dụ 3: Sai label
Ground Truth Label hiện tại: Townhomes
Charming Renovated Farmhouse on 2.86 Acres!Discover peaceful country living in this adorable, updated farmhouse nestled on nearly 3 acres of open, usable land. Perfect for homesteading or hobby farming, this property features a lush garden, greenhouse, and fenced pasture ideal for animals. Recent updates include a durable metal roof and a sand filter septic system for peace of mind. Whether you're looking to garden, raise livestock, or simply enjoy quiet rural life, this property offers the perfect blend!
Nhận xét: sau khi xem lại nội dung, nhãn hợp lý hơn có thể là Farm thay vì Townhomes.
BERT Full Fine-tune (Minimal + Augmented) - All Incorrect
DistilBERT Full Fine-tune (Minimal + Augmented) - All Incorrect
DistilBERT Full Fine-tune (Minimal + Standard) - All Incorrect
09
Thử nghiệm trực tiếp trên Gradio - Hugging Face Space
Gradio - Hugging Face Space
Nếu iframe bị lỗi, bấm nút bên dưới để mở Hugging Face Space ở tab mới.
Samples for Class: single_family
Sample 1: Showings subject to accepted offer. Investor opportunity in Cathedral Park on a nearly 10,000 sq ft CM3-zoned lot. Property is located within the Richmond/Crawford Improvement Project area; planned improvements, timelines, and associated costs apply e City of Portland link buyer to perform all due diligence. Convenient location near downtown St. Johns, shops, and parks. No sign on property. Do not disturb tenant.
--------------------
Sample 2: *DO NOT DRIVE BY WITHOUT AN APPOINTMENT* Distressed property due to land movement, drainage and foundation damage. Tucked away on 7 peaceful acres, this private retreat offers the perfect balance of nature, space, and convenience. A year-round creek winds through the property, creating a serene setting surrounded by mature trees and the quiet beauty of the outdoors. The home features 4 bedrooms plus a versatile bonus space-ideal for a home office, creative studio, or even a home-based business. Inside, you'll find fresh new carpet and interior paint, giving the home a clean and welcoming feel. The kitchen includes a center island, all appliances, and a window overlooking the woods, bringing natural light and tranquil views into the heart of the home. Step outside onto the expansive deck and take in the peaceful scenery-an ideal spot for morning coffee, outdoor dining, or simply enjoying the privacy and sounds of the creek below. The property also includes a 24x30 shop, perfect for hobbies, projects, storage, or extra workspace. This is truly a retreat-like setting-a place to escape, unwind, and enjoy the beauty of nature, while still being close to town with easy freeway access for everyday convenience.
--------------------
Samples for Class: condos
Sample 1: This exceptional property is priced to sell & is a must-see for fly fishing enthusiasts. One-quarter shared interest is available in this stunning 3 bedroom cabin (2 en-suite), 3 baths; located at the historic Lake Creek Lodge in Camp Sherman. The cabin, constructed in 2011, seamlessly blends modern amenities w/ vintage charm, featuring fir plank floors, knotty pine paneling, & a beautiful stone and gas fireplace. The kitchen is a cook's delight, equipped with butcher block countertops, gas cooktop, & farmhouse sink. Special attention has been given to the tile bathroom floors & showers, & the cabin includes a washer/dryer, expansive wood decks, & attractive stone exterior accents. Homeowners enjoy access to a range of amenities: swimming pool, tennis / pickleball cts, a fly-fishing pond, scenic trails, & Lodge/restaurant. Furthermore, the Resort offers abundant recreational opportunities; including golf, skiing, and world-class fly fishing on the Metolius River.
--------------------
Sample 2: Sophisticated and beautifully updated riverfront townhome in an exceptional location just steps from the Willamette River. Designed for modern living and effortless entertaining, this 3 bedroom, 4 bath home features a stunning remodeled chef's kitchen with walnut cabinetry, waterfall-edge island, and premium appliances. The light-filled second level offers a serene primary suite with floor-to-ceiling windows, a custom walk-in closet, and a luxurious primary bath retreat. The expansive top floor provides flexibility for a media room, office, or guest suite and opens out to two generous rooftop decks showcasing panoramic views of downtown Portland and the Willamette River. With over 600 square feet of outdoor living space, this is a rare opportunity for elevated waterfront living at The Strand. Enjoy the convenience of living in this unbeatable location with trails, kayaking, Streetcar, restaurants, and so much more right outside your door.
--------------------
Samples for Class: land
Sample 1: Owner financing available! Explore and enjoy 5.7-acre land! Perfect for geole who enjy a suburbon rural mix place
--------------------
Sample 2: Here's your chance to own 1/[Redacted Entity] County with hunting & fishing rights and approximately 4,200 feet of Coast Fork Willamette River frontage. (Property may also be sold as single ownership at $1,250,000) Pasture provides space for grazing livestock, and five scenic ponds and lakes are ideal for water sports, serious bass fishing, dog training, and waterfowl. Currently leased month to month to a duck hunting club and they'd be happy to stay, or go. Ideally located just 16 miles south of Eugene and 3 miles north of Cottage Grove with easy I-5 access. This is a multifaceted, serious recreational holding where weekends become competence and character building traditions. Please ask your favorite agent to get you access to the VIDEO that MLS won't let us load as it features a person catching a REALLY big fish.
--------------------
Samples for Class: farm
Sample 1: Turnkey Irrigated Farm with Established Infrastructure: Fairview Farms presents a rare opportunity to own a well-rounded Eastern Oregon agricultural operation designed for both alfalfa production and cattle management. Located west of Burns in a region recognized for strong irrigation wells and high-yield alfalfa ground, this productive farm encompasses 885 deeded acres with 680 acres of water rights dating back to 1982 and 1993. Set up as a turnkey farm and ranch, the property includes productive irrigated ground, cross-fenced pasture, cattle working facilities, hay storage, equipment buildings, and two homes. The thoughtful layout allows efficient movement of equipment and livestock while maintaining a functional and organized operation. With decades of proven production, Fairview Farms offers an excellent opportunity for owner-operators looking to expand their hay base, cattle producers seeking a balanced outfit, or investors looking for a productive agricultural asset. Reliable Irrigation & Productive Crop Ground: Irrigation at Fairview Farms is both extensive and diversified, supported by four irrigation wells and multiple delivery systems that maximize production across the farm. The majority of the acreage is irrigated by three center pivots covering approximately 550 acres, including one large pivot encompassing 275 acres. Additional irrigation is provided through wheel lines covering over 80 acres, along with smaller areas of handlines and flood irrigation. This system allows flexibility in crop rotation, pasture development, and seasonal management. Historically the farm has been planted in alfalfa and grass, with the grass stands primarily utilized for irrigated pasture. Currently, 250 acres are planted in triticale, seeded as part of a rotation program and positioned to transition back into new alfalfa stands. The remaining irrigated ground is primarily planted in alfalfa, creating strong hay production potential. Several pivot corners are planted in crested wheatgrass and fenced, offering additional grazing opportunities throughout the year and further supporting a balanced cattle operation. Balanced Cattle Operation with Expansion Potential: While hay production has been the primary focus, the current owners maintain a year-round herd of approximately 40-50 cow/calf pairs. Thoughtfully designed cross fencing and irrigated pastures allow efficient livestock management while supporting rotational grazing. The property includes two irrigated pastures-one flood irrigated and one under pivot-allowing cattle access to quality forage during the grazing season. With existing infrastructure already in place, a future owner could easily expand cattle numbers and transition the operation toward a larger cow outfit with minimal investment. A well-designed set of corrals and cattle working facilities sits near one of the homesites. The setup includes sorting pens, a covered working facility with alley and chute, and a heated veterinary or medication room. Several pens are located beneath the covered working area, and a small feedlot positioned behind the facility provides convenient winter feeding access. Well-Planned Improvements & Operational Facilities: The improvements at Fairview Farms are strategically located along Scott Road, allowing convenient access for trucks, hay equipment, and farm machinery. Each improvement site is perimeter fenced and built with gravel pads designed for equipment storage and efficient operation. Hay storage is a major asset of the property, with three large hay sheds providing over 28, 000 square feet of covered storage. One of the sheds, constructed in 2015 using powerline poles, spans more than 12, 000 square feet, while two additional steel-beam structures provide over 16, 000 square feet combined.
--------------------
Sample 2: Discover 58.55 acres in the heart of Tumalo, where sweeping Cascade Mountain views set the backdrop for endless possibilities. Whether your vision is an expansive private estate, a premier equestrian facility, or productive farmland, this exceptional property offers a remarkable canvas. Currently home to a hunting dog operation, the land features 39.21 acres of TID irrigation (portion in in-stream lease), open pastures, and garden areas. The single-level 3,016 sq. ft. residence showcases a great room concept, an updated kitchen with granite counters and custom cabinetry, and a primary suite with office, private view deck, and spacious bath with walk-in closet. Two additional ensuite bedrooms. Property amenities include a heated and plumbed dog kennel, outbuilding, and multiple run-in/storage sheds. With three tax parcels and EFU zoning, this is an extraordinary opportunity to create your dream property in a highly sought-after Tumalo location.
--------------------
Samples for Class: multi_family
Sample 1: Motivated Sellers Rural Commercial Zoning, lots of possibilities. Come see the opportunities available to you with this income property. The Old House is a tear-down special. There is a Fixer-upper duplex, with tenants in place. This is an AS/IS purchase. Will need 24-hour notice for showings. Please do not disturb current tenants.
--------------------
Sample 2: Santa Clara duplex built in [Redacted Entity] with one vacant unit and one occupied at $1,600 per month. Each unit offers 3 bedrooms, 2 full bathrooms, and a half bath on the main level. The vacant side is move-in ready with LVP flooring and carpet. Kitchens and bathrooms feature tile flooring for durability. Forced air HVAC. The occupied side has a long-term month-to-month tenant with a strong rental history, providing immediate income. Both units include a one-car garage with washer and dryer hookups, fenced backyards, and very low-maintenance landscaping. Convenient location near Albertsons, Fred Meyer, restaurants, Santa Clara Station Park & Ride, and easy access to the Beltline. Strong option for an owner-occupant looking to offset a mortgage payment, or an investor seeking a solid 1031 exchange opportunity. DO NOT DISTURB TENANT! By Appointment Only.
--------------------
Samples for Class: townhome
Sample 1: This new three-story home boasts a modern and low-maintenance layout. The first floor is host to an inviting open floorplan that combines the kitchen and Great Room, with a nearby patio offering convenient outdoor access. Three bedrooms can be found on the second floor, including the luxurious owner's suite. A versatile bonus room makes up the third level, providing a convenient shared living area that everyone can enjoy.
--------------------
Sample 2: This new two-story townhome offers plenty of space to live and grow. The first floor is host to an inviting open-concept floorplan where the kitchen, living room and dining area meet, perfect for everyday transitions and entertaining. Two luxurious owner's suites are located on the second floor, each featuring a full bathroom and walk-in closet, just steps from a versatile and inviting loft space. The home includes a convenient single-bay garage.
--------------------
Samples for Class: unknown
Sample 1: This thoughtfully designed three-story townhome offers maximum living space, beginning with a two-car garage featuring extra space for parking and storage.. The second floor welcomes you with an open and spacious layout, seamlessly connecting the main living areas, including the living, and dining areas. The spacious kitchen is a highlight, boasting a center island perfect for gathering, ample counterspace, and modern appliances, making meal prep a breeze. Enjoy quiet mornings and serene evenings on the covered balcony, soaking in the fresh air. Ascending to the third floor, youll find three bedrooms, including a primary bedroom and bath with dual sinks and a shower. The conveniently located laundry near the bedrooms adds to the comfort and ease of everyday living.
--------------------
Sample 2: The Provence floorplan offers a spacious and modern living experience with a tandem 2-car garage and a fenced backyard.. The first floor features an inviting entry porch, a powder room, and a coat closet. The second floor boasts a well-designed kitchen with a pantry, dining, and living areas, along with a balcony for outdoor relaxation. The third floor includes a primary bedroom with a walk-in closet and primary bath, two additional bedrooms, a second bath, and a convenient stacked washer/dryer laundry area.
--------------------
Samples for Class: townhomes
Sample 1: Tucked into the natural beauty of Westfir, [Redacted Entity] offers a rare chance to create something truly special.Set on .41 acres, the property features a 2-bedroom, 1-bath main home with a spacious living room, generous kitchen, dedicated laundry room, and two covered porches perfect for enjoying peaceful surroundings.A detached ADU adds even more potential, complete with its own kitchen, bathroom, living area, and bedroom - ideal for future rental income, guest space, or multi-generational living.Two additional outbuildings provide storage and workshop possibilities. One structure was damaged in a storm and will require removal.This is a fixer and will need substantial renovation. For the right buyer, this is an opportunity to restore, reimagine, and build equity on nearly half an acre in a scenic Oregon setting.Priced at $200,000 and sold as-is.Bring your vision. The potential is here.
--------------------
Sample 2: This beautifully designed duet home offers a welcoming blend of style and functionality. On the main floor, an open-concept design creates a natural flow between the kitchen, living, and dining areas, making the space feel bright and connected. The kitchen includes a refrigerator, while everyday conveniences like a washer, dryer, and window blinds are already in place. Just beyond the living area, a private patio provides a quiet outdoor escape. Upstairs, three spacious bedrooms await, including a serene owner's suite with a walk-in closet and attached full bathroom.
--------------------