{'fraction_non_alphanumeric': 0.027568805196018877, 'fraction_numerical': 0.006214662866221204, 'mean_word_length': 4.968209704406023, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
RELARM: A rating model based on relative PCA attributes and k-means clustering

Following widely used in visual recognition concept of relative attributes, the article establishes definition of the relative PCA attributes for a class of objects defined by vectors of their parameters. A new rating model (RELARM) is built using relative PCA attribute ranking functions for rating object description and k-means clustering algorithm. Rating assignment of each rating object to a rating category is derived as a result of cluster centers projection on the specially selected rating vector. Empirical study has shown a high level of approximation to the existing S&P, Moody's and Fitch ratings.


I. Introduction
Credit rating agencies play an important role in providing financial markets with indicative and prognostic information leading to increase of market efficiency. One of the key factors when choosing the rating agency is the creditor's confidence in its estimates, so that each agency is struggling to improve their assessments transparency for the rating end-users. It should be noted that the mentioned problem is often referred to the newly created agencies while they are building the agency reputation. Companies, investors and stakeholders thoroughly examine the evaluation principles of their rating methodologies at that time. In this regard, when establishing the rating methodology you might face a problem of the result objectivity. In this context, a rating methodology objectivity means a minimum presence of model factors evaluated solely by expert judgment.
It is important to mention that one of the rating agency's priority is to choose the type of model that describes a rating object with a minimum use of subjective expert factors.
Usually credit rating models are scoring type models. A scoring model involves obtaining the integral numerical index based on quantitative and qualitative parameters where each of them has a certain influence on the creditworthiness of a rating object expressed by a specific weighting factor. Such models can be built using econometric tools (ranging from simple linear regression to logit and probit models), multiplicative discriminant analysis, neural networks, support vector machine techniques or on the basis of expert judgment [1], [2], [3], [4].
The difference between the rating model types is in various approaches to rating object data base processing, diversity in tools for model establishment and variation in obtaining of weight coefficients.
For example, factor weights in a model based on expert judgment are determined by an expert community, however the other model types often involve special model training to find the right weights. It should be noted that model factors are always an expert community matter of choice and their selection is carried out in accordance with a concept of inclusion the majority of relevant to analyzed rating object characteristics.

Problem formulation
Credit rating agencies commonly use evaluation models with a high degree of expert component and some of them incorporate models based on econometric tools. Here the expert part is to identify the degree of factors' influence on the final rating as well as to determine intervals of model parameters for the following point assignment.
The main difficulty of such rating methodologies is that expert methods are not always transparent to the rating end users as there might exist plenty opinions about a specific weight of an indicator or a model part as well as options for their numerical values interpretation. In addition, a model construction and calibration based solely on expert judgment practically can lead to bias in the final rating. For example, the expert selection of factor weights may cause significant inaccuracy in resulting rating assignment due to a possible high level of interdependence between the analyzed indicators.
On the other hand, the choice of an econometric method for model construction or simulation of a neural network system requires a broad rating history database for model training and adjustment, otherwise, there might occur substantial errors in rating prediction and assignment.
Thus, the lack of access to a full rating history database is the second major difficulty in building an accurate automated rating model. Furthermore, it should be noted, that existing in practice and described in scientific literature rating models, in fact, are built regardless of a rating object's interdependencies, although practically such kind of difficulties can be coped with an expert rating committee decisions.

A new rating model based on relative PCA attribute ranking functions
In this paper, we introduce a new rating model based on relative PCA (principal component analysis) attribute ranking functions and k-means clustering (RELARM: Relative Attributes Rating Model) with the following distinctive features: 1. Rating assignment taking into account comprehensive rating object interdependencies; 2. Simplicity of model training and calculation on small but relevant data array.
The proposed model aims to determine a rating object creditworthiness (financial strength/ stability) based on the principle of "living organism" where each element change (even very small) causes certain reflection on the state of other analyzed system objects. Incorporation of a new for rating models definition of the relative PCA attributes provides the most comprehensive description of analyzed rating object characteristics. It should be emphasized that obtained by RELARM rating results are robust if model parameters are properly chosen.
The described above the second model's feature signifies a possibility to train RELARM on the 1-2 years relevant to rating object data, so that it is becoming unnecessary to use large training samples (e.g. 10, 20, 30 years etc.). It should be noted that model adjustment is going to be more accurate with an increase of data horizon. However, adequate model results might be obtained with a minimum years of relevant data. Therefore, proposed in the article new rating model (RELARM) is aimed to provide credit rating agencies with a rating methodology based on the principles of rating objectivity and transparency even when they experience limitations on training data sample.
In Section II, we describe related to the paper works. In Section III, we present the theoretical concept of RELARM. In Section IV we show an empirical study and section V concludes.

II. Related works
Nowadays the credit rating topic is very popular in scientific literature. There exist a large amount of works on such topics as rating modeling, credit scoring and determination of credit quality.
The current section contains a small part of the research works on actual rating modeling however these papers clearly reflect the relevance of the chosen theme as well as they show a variety of tools possible to apply.
We conditionally divide the existing papers on rating modeling into 3 types (by the type of tools they suggest to apply):  models using expert judgment,  models using econometric tools,  models using machine learning techniques.

Models using expert judgment
In practice, credit rating agencies often use models based on expert judgment.
One of the most frequent methods used to determine influence of rating model factors with the use of expert opinion is called Analytic Hierarchy Process (AHP). In [5] AHP is incorporated in conjunction with the grey hierarchy evaluation model. Another approach is presented in [6] where the credit quality is explored with the improved grey relation analysis (GRA), AHP and TOPSIS (the Technique for Order Performance by Similarity to Ideal Solution). Paper [7] proposes credit default risk evaluation based on Dynamic Multiple Criteria Decision Making Model, AHP and UTADIS (UTilites Additives DIScriminantes) method for the final scores computation and ranking.

Models using econometric tools
Regression models are the second most popular models type applied by rating agencies in practical field. It should be noted that the most commonly used form of regression in credit ratings is a logistic regression. For example, the general principles can be found in [8] where the model is built and tested with inclusion of quality parameters. In [9] a credit scoring model based on fuzzy logistic regression is constructed. Another variant is presented in [10] where authors used an ordinal regression approach to construct a rating model for sovereign creditworthiness assessment.

Models using machine-learning techniques
In the last decade machine-learning techniques such as neural networks and support vector machines were intensively developed. They have been widely used in image recognition systems as well as in theoretical credit rating modeling, determination of credit risk and quality.

III. RELARM theoretical description
Current section reveals the theoretical concept of a new rating model based on relative PCA attribute ranking functions and k-means clustering. Here is presented in detail a step by step description of RELARM construction.
RELARM is based on 4 phases: Normalization of input dataunification of initial model parameters for their comparison using linear scaling method.

II.
Relative PCA attribute ranking functions calculation, normalized parameter vectors mapping in the space of relative PCA attribute ranking function values and formation of the rating vector.
III. k-means clustering of the relative PCA attribute ranking function space vector values with cluster centers obtaining.

IV.
Rating assignment of analyzed rating objects by projection on the rating vector.
In 3.1 we describe normalization of factors procedure. Then in 3.2 we give a definition of relative PCA attributes and their ranking functions for rating object description. The mapping in the space of relative PCA attribute ranking functions values is defined. In 3.3 we show k-means clustering application to the proposed model.

Normalization of RELARM input parameters
Suppose that a rating model consists of N factors and M rating objects. We apply a linear scaling method in order to standardize rating model parameters for their comparability.
Let , ∈ [ ], ∈ [ ] denote the initial value of the j-th parameter of the i-th rating object.
We define a normalized value of , where ∈ [ ], ∈ [ ], depending on the j-th factor's influence on the model property studied.
If an increase of index value has a positive impact on the final analyzed property, the formula becomes: If a model parameter increase has a negative effect on the final rating, then normalized value is calculated as: As a result of (3.1) and (3.2) each rating object is described by a (1 x n) dimension row vector of normalized parameters: denote a set of normalized parameters.

Rating object characteristic using relative PCA attribute ranking function values
Current paragraph reveals the second phase of RELARM construction, namely the mapping of normalized vectors , ∈ [ ] to the space of relative PCA attribute ranking function values.
The concept of attributes is widely used in image recognition algorithms. It is most often presented in recognition using binary properties, which predicts a presence or an absence of a specific attribute (e.g. smiles on photos, determination of a landscape type etc.). However, the use of such algorithms has certain restrictions and often leads to ambiguous recognition or total disregard of a characteristic. Later in paper [19] it is proposed an application of relative attributes providing semantically more rich method for object description, which uses objects features comparison in relation to each other. The concept of relative attributes provides a relative strength of specified features presence of an object compared to other objects.

Definition of a relative PCA attribute and its ranking function
Definition. Let p-th relative PCA attribute of vector ∈ = 1,2, … be a vector ip A : (3.6) Further we can also name the p-th relative PCA attribute of a vector as the p-th main attribute vector. In accordance with the concept presented in [19] we say that the p-th main attribute has a stronger presence in vector than in vector , if 1 -norm of vector ip A is greater than 1 - Therefore, the ranking vector for p-th main attribute is the vector 8) and the ranking function is defined by formula: We define × matrix as: where the number of principal components is determined to avoid the influence of «data noise». We recommend to take the number of principal components providing approximately 95% of data information.
We define the rating vector Λ as: Λ: = ( 1 , 2 , … , ). Here: For the i-th rating object each component of vector indicates the degree of influence of object's parameter changes with respect to the corresponding principal component.

Rating assignment using k-means clustering
In this paper, k-means algorithm [20], [21] is used for the final rating objects classification to specific rating categories.
It should be noted that we take Euclidean distance as a distance measure between data points but practically it is possible to use other existing distance options suitable for a particular issue.
Partitioning of rating objects to rating classes includes 4 stages: 1. K-means clustering algorithm application to obtained in 3.2 vectors of relative PCA attribute ranking function values (3.13) . The output cluster centers we denote by , ∈ (1,2, … , );

3.
Ranking of centers projection on the rating vector in descending order (the higher the value the better credit quality);

4.
Rating assignment on the basis of 1 and 3.
Module of projection of the q-th cluster center on the rating vector Λ (3.11) is calculated as follows: = |( , Λ)|, ∈ (1,2, … , ). (3.14) Note. We can assume intuitively that the l-th value of the rating vector Λ is proportional to probability that comparison by the l-th main attribute ranking function is correct. Thus, can be considered as analogue of module of a rating object's expected value.
Finally, we rank obtained values , ∈ (1,2, … , ) in descending order and form a rating list containing analyzed rating objects with respect to assigned rating classes.

IV. RELARM empirical study
In current section, we present an empirical example of RELARM application based on the theoretical concept proposed in the previous section.

Data and model parameters
The initial and fundamental phase of a rating model construction is the selection of the most relevant parameters characterizing a rating object as full as possible within evaluation of a certain property (e.g. creditworthiness, reliability, efficiency, quality, etc.). Criteria choice largely influences the final model result providing minimum outliers if they were picked correctly.
Consequently, for realization of an experiment we selected a part of indicators for sovereign credit rating assessment used by Standard & Poor's, Moody's и Fitch rating agencies. It is also important to mention that our criteria choice was based on the possibility to collect the latest data. 6 Thus, 9 financial and economic parameters, fundamental for economy description, were selected. The description is presented in Table 1.
In addition to financial and economic indicators there also included an expert factor with a distribution [0,1] (likewise the other normalized parameters). It is supposed to reflect an expert opinion on the country's economy strength, a possibility to gain financial support from other countries, «soft power» as well as prediction of economy's power. In order to conduct an experiment 30 countries were selected.
Data for the selected criteria were taken from public statistical databases: the World Bank, data from country's statistical agencies, central banks and other sources.

Calculations
Once the evaluation criteria were selected, a country list was compiled and all the relevant data was collected, normalization of the input data should be made. However, before that step to be done, it is necessary to determine the influence of each factor on the final property studied, namely creditworthiness (Table 2).
Next, normalized values for each factor are calculated according to formulae (3.1) and (3.2) for factors with positive and negative influence respectively. Table 3 shows an example of normalized values calculation. Matrix of normalized countries' indicators values is presented in Table 5. As it was mentioned above, we also inserted a specific expert factor (with [0,1] distribution) in addition to selected economic and financial indicators.
Based on the matrix of normalized country indicators values (Table 4) with an added expert factor, the number of principal components d and matrix (3.10) are determined. The calculated matrix is presented in Table 5.
Next, the mapping in the space R d of relative attribute ranking functions values (3.12) is performed. It should be noted, that in this particular case we selected 6 principal components which ensure preservation of 96% data information. Also the rating vector Λ (3.11) was obtained ( Table 6).
Therefore, we have 30 vectors in the R 6 space corresponding to each country of a sample and then the algorithm described in 3.3 is performed. As we consider a small sample for the experiment, it was decided to take k=7 for k-means clustering which means that we exclude rating subcategories and consider the following classes: AAA, AA, A, BBB, BB, B, CCC. It should be mentioned that Euclidean distance was selected for the clustering algorithm. Kclustering allowed to make homogenous groupings as well as to compute cluster centers presented in Table 7.
Next, according to algorithm from 3.3, modules of projections were found, then ranking of obtained cluster projections was made and, finally, rating assignment to each country was performed.
The resulting RELARM rating was compared with existing country ratings on 31.07.2016 (source: Thomson Reuters Eikon) assigned by S & P, Moody's and Fitch rating agencies. We consider a country's RELARM rating to be a success result, if it matches one of the real ratings of the above-mentioned rating agencies. Since we divided the test sample into 7 rating categories, excluding subcategories, the test model country's result is identical to an existing country rating if it complies with the general rating category (Ex .: the country's rating of the test model is AA and this country has Fitch AA + : RELARM rating matches the real one).
Thus, an experiment model based on RELARM method showed results presented in Table 8. It can be seen from the Table 8 that RELAM method provided 86% approximation to real ratings.
Moreover, such an effective result was gained using only 10 model factors. In addition, thorough indicators selection in conjunction with a correct model and k-means clustering adjusting can provide an opportunity to refine the results. It should be noted, the resulting country distribution to rating categories is a recommendation to a rating agency's rating committee for a rating assignment, however the final decision on the rating level is always made by experts.
The result obtained using RELARM approach is adequate and appropriate for implementation in rating agencies practical activities.

IV. Conclusion
A new rating model based on the relative PCA attributes ranking functions and k-means clustering was proposed.
RELARM provides the most comprehensive rating objects description by introducing the relative PCA attributes concept for object's parameters vector.
An empirical study showed high approximation level to actual countries credit ratings, which proved the RELARM approach to be adequate. A wise model factors selection and correct clustering mechanism adjusting can ensure results accuracy. Simplicity of model training and results computation at the same time are the basis for RELARM implementation in the practical field of rating agencies.

Acknowledgement
Author expresses deep gratitude to A.A. Irmatov for valuable comments and attention for this paper. Economic competitiveness, which is the country's ability to provide high level of well-being for citizens according to the World Economic Forum. Moody's

GDP per capita
In general terms, it shows the level of economic development and prosperity.

4.Government debt/GDP
In general terms, the higher level of public debt leads to the greater country risk of default. Nevertheless, such relationship is not linear, and it should be considered in conjunction with other factors.

5.Budget surplus (+) or deficit (-) (% of GDP)
Generally, a large budget deficit shows the fiscal policy inconsistency and, if other things being equal, it may lead to an increase in the debt burden.

Inflation level
In the general sense, the low inflation level and economic growth lead to a more stable credit position and vice versa.
Moody's Generally, high inflation volatility suggests monetary policy inconsistency and vice versa. Moody's

(Current account balance + Foreign direct investments)/GDP
Indicator characterizes the ability to cover a current account deficit -the higher index value, the lower probability of a debt burden increase and, thus, the lower chance of creditworthiness reduction.

Reserves
Country's «buffer» in various financial or economic shocks. Generally, higher values indicate a higher country's stability in such crises.