Urgent.News

What's breaking now, across thousands of outlets.

Tech

Predicting the Financial Health of Small Businesses with Python

Introduction Small businesses keep many African economies going, but it is often a struggle for their owners when it comes to getting loans, insurance and other financial services. If we could tell from a few survey answers which businesses are doing well and which are struggling, the right people could get help faster. That was the question behind this project. The data came from the data.org…

Small businesses play a significant role in many African economies, yet entrepreneurs often face challenges when seeking loans, insurance and other financial services. To address this issue, a project was initiated to predict the financial health of small businesses based on their survey responses. The data used in this project came from the Financial Health Prediction Challenge on Zindi, and the objective was to determine whether a business had low, medium or high financial health.

The dataset consisted of 9,618 small business owners from Eswatini, Lesotho, Malawi and Zimbabwe, with 39 columns each. These questions covered various aspects of the business and its owner, including age, gender, turnover, age, financial products used, money handling practices, and future outlook. Each business was classified into one of three groups using a Financial Health Index, which takes into account savings and assets, debt and repayment ability, resilience to shocks, and access to credit.

Before diving into the data, it was crucial to understand the information at hand. The dataset included a variable definitions sheet that clarified the purpose of each column. After reviewing this documentation, basic data checks were performed. These checks included verifying the dataset's dimensions, identifying duplicate rows, counting missing values, and assessing the distribution of the data.

The dataset was divided into categorical (text) columns and numerical columns, as different data types often require distinct solutions. Categorical columns were addressed first, with extra spaces and capital letters being trimmed and all text converted to lowercase. However, it was discovered that some categorical columns contained unique apostrophe characters and variations in answering "don't know."

Additionally, there were hidden invisible characters and unexpected 0 values. These inconsistencies were addressed by merging similar entries into a single spelling.

Moving on to numerical columns, it was observed that several columns had extreme outliers that significantly deviated from the rest of the data. Some columns also contained missing values. To tackle these issues, the data was split into categorical and numerical groups.

In the case of categorical columns, missing values were handled based on specific criteria. Columns with missing data exceeding 35% were treated differently than the rest. A total of twelve columns exceeded this threshold, with missing answers ranging from 37% to 47% across the countries. Upon further investigation, it was found that Lesotho did not have any responses for eleven of the categorical columns, such as gender, credit card ownership, and insurance. This was likely due to the fact that these questions were not asked in that particular country.

For training data, columns with more than 35% missing values were categorized as 'unknown', given that the absence of an answer could also provide valuable information. Six other categorical columns had minimal missing data, so they were filled with the mode (the most frequently occurring value). The decision to apply the 35% cut-off was a personal judgment and not a predetermined rule. This approach was applied within each country instead of uniformly across all countries to account for regional variations.

The most challenging aspect of the project was handling monetary data, as income, expenses, and turnover were recorded in each country's local currency. To standardize currency, a function was created to look up each row's country, retrieve the corresponding exchange rate, and convert the monetary values to US dollars.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Three of Five Founder Mailboxes Rejected first.last, the Layout Everyone Defaults To

I run a visa agency in Bali, and the other half of my week goes into Apify Actors. One of them is narrow on purpose: you give it a LinkedIn profile URL, it gives you back the person's name, title…

  • Three out of five founder mailboxes rejected default layout first.last
  • Second choice first@domain.com succeeded in three out of five instances
  • Default layout fails due to lack of personal address info on company websites

App can't connect to the server? Use Test-NetConnection before you reinstall

"The app says it can't connect to the server" is a classic help desk ticket. The tempting fix is to reinstall the app. Before you do that, spend one minute finding out whether the problem is the…

  • Use Test-NetConnection to diagnose network issues before reinstalling apps.
  • Identify server name and port from application settings or documentation.
  • Run Test-NetConnection appserver01 -Port 443 to test connection.

A Lab Just Open-Sourced Its Training Harness (Plus 501B Weights)

Reflection AI dropped Beam this week — 501 billion parameters of open weights under Apache 2.0. That's the headline. But here's what actually caught my eye: they also open-sourced Mirror CLI, their…

  • Reflection AI released Beam, a 501 billion parameter open-weight model.
  • Mirror CLI is the training harness, a rare move by labs to share training code.
  • Beam supports BF16, FP8, and NVFP4 weight formats for fine-tuning and pretraining.

More from Saturday 17 October →