Skip to main content

Intelligent Credit Analysis with NeoSpace AI

This use case demonstrates how financial institutions can use the NeoSpace AI platform to automate and enhance the credit analysis process, resulting in more accurate decisions and risk reduction.

Overview

Traditional credit analysis often relies on limited metrics such as FICO scores and payment history. In this practical example, we demonstrate how NeoSpace AI enables:

  1. Analysis of structured and unstructured customer data
  2. Identification of non-obvious financial behavior patterns
  3. Calculation of personalized risk scores
  4. Automation of credit decisions with high accuracy

Python Implementation

This example implements a complete credit analysis flow that uses NeoCredit to evaluate loan applications.

import os
import requests
import pandas as pd
import json
from datetime import datetime

# NeoSpace API Configuration
NEOSPACE_API_KEY = os.environ.get("NEOSPACE_API_KEY")
NEOSPACE_BASE_URL = "https://api.neospace.ai/v1"

# Function to authenticate with the API
def get_token():
"""
Gets authentication token for the NeoSpace API

Returns:
Valid access token
"""
headers = {
"Content-Type": "application/json"
}
payload = {
"api_key": NEOSPACE_API_KEY
}
response = requests.post(
f"{NEOSPACE_BASE_URL}/auth/token",
headers=headers,
json=payload
)
response.raise_for_status()
return response.json()["access_token"]

# Function to send customer data for analysis
def analyze_credit(customer_data):
"""
Sends customer data for credit analysis

Args:
customer_data: Dictionary with customer data

Returns:
Credit analysis result
"""
token = get_token()
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
response = requests.post(
f"{NEOSPACE_BASE_URL}/neocredit/analysis",
headers=headers,
json=customer_data
)
response.raise_for_status()
return response.json()

# Function to process result and make decision
def process_decision(analysis_result, score_threshold=70):
"""
Processes the analysis result and makes a decision

Args:
analysis_result: Credit analysis result
score_threshold: Minimum score for approval

Returns:
Credit decision and details
"""
score = analysis_result["credit_score"]
risk = analysis_result["risk_level"]

approved = score >= score_threshold

# Credit limit calculation based on score
if approved:
if score >= 90:
credit_limit = 50000
elif score >= 80:
credit_limit = 30000
else:
credit_limit = 10000
else:
credit_limit = 0

decision = {
"customer_id": analysis_result["customer_id"],
"approved": approved,
"score": score,
"risk_level": risk,
"credit_limit": credit_limit,
"interest_rate": calculate_interest_rate(score, risk),
"reasons": analysis_result["decisive_factors"],
"analysis_date": datetime.now().isoformat(),
"recommendations": analysis_result["recommendations"]
}

return decision

# Function to calculate personalized interest rate
def calculate_interest_rate(score, risk_level):
"""
Calculates personalized interest rate based on score and risk level

Args:
score: Credit score
risk_level: Risk level (low, medium, high)

Returns:
Annual interest rate in percentage
"""
# Base rate
base_rate = 12.0

# Score adjustment
if score >= 90:
score_adjustment = -3.0
elif score >= 80:
score_adjustment = -2.0
elif score >= 70:
score_adjustment = -1.0
else:
score_adjustment = 0.0

# Risk adjustment
if risk_level == "low":
risk_adjustment = 0.0
elif risk_level == "medium":
risk_adjustment = 2.0
else: # high
risk_adjustment = 4.0

return base_rate + score_adjustment + risk_adjustment

# Function to record decision in the system
def record_decision(decision):
"""
Records the credit decision in the system

Args:
decision: Dictionary with decision details

Returns:
Registration confirmation
"""
token = get_token()
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
response = requests.post(
f"{NEOSPACE_BASE_URL}/neocredit/decisions",
headers=headers,
json=decision
)
response.raise_for_status()
return response.json()

# Main processing function
def process_credit_application(customer_id, additional_data=None):
"""
Complete flow for processing a credit application

Args:
customer_id: ID of the requesting customer
additional_data: Complementary data for analysis

Returns:
Credit decision result
"""
try:
# 1. Prepare customer data
customer_data = {
"customer_id": customer_id,
"analysis_type": "personal_loan",
"application_date": datetime.now().isoformat()
}

# Add additional data if provided
if additional_data:
customer_data.update(additional_data)

# 2. Send for analysis
analysis_result = analyze_credit(customer_data)
print(f"Analysis completed for customer {customer_id}")

# 3. Process decision
decision = process_decision(analysis_result)
print(f"Decision generated: {'Approved' if decision['approved'] else 'Rejected'}")

# 4. Record decision
confirmation = record_decision(decision)
print(f"Decision registered with ID: {confirmation['decision_id']}")

return {
"customer_id": customer_id,
"decision_id": confirmation['decision_id'],
"approved": decision['approved'],
"credit_limit": decision['credit_limit'],
"interest_rate": decision['interest_rate'],
"status": "completed"
}

except Exception as e:
print(f"Error: {str(e)}")
return {
"customer_id": customer_id,
"status": "error",
"message": str(e)
}

# Example usage
if __name__ == "__main__":
customer_id = "cli_12345"
additional_data = {
"requested_amount": 25000,
"term_months": 36,
"purpose": "home_improvement",
"monthly_income": 8500,
"current_employment_duration": 48 # months
}
result = process_credit_application(customer_id, additional_data)
print(json.dumps(result, indent=2))

Benefits of the Solution

Using NeoSpace AI for credit analysis provides several benefits:

  • Holistic Analysis: Considers multiple data sources beyond traditional credit history
  • Risk Reduction: Identifies patterns of behavior that indicate a higher probability of default
  • Personalization: Offers personalized rates and limits for each customer profile
  • Automation: Reduces analysis time from days to seconds
  • Consistency: Eliminates human biases and ensures decisions based on objective criteria
  • Scalability: Processes thousands of applications simultaneously

Proven Results

A medium-sized financial institution implemented this solution and achieved the following results:

  • Reduction of 35% in default rate
  • Increase of 28% in credit approval for good payers
  • Reduction of 70% in application processing time
  • Savings of 45% in operational costs of the credit department
  • Increase of 22% in customer satisfaction

Implementation Considerations

  • Regulatory Compliance: The solution is compliant with data protection regulations
  • Explainability: The system provides clear justifications for each decision
  • Continuous Monitoring: It is recommended to regularly monitor the model's performance
  • Integration: The API integrates easily with legacy systems of financial institutions

Next Steps

To implement this solution in your institution:

  1. Request a personalized demonstration
  2. Explore the complete API documentation
  3. Learn about other use cases and examples