Cluster.OBeu
is used
on OpenBudgets.eu data
mininig tool platform with OpenCPU
integration of R and JavaScript to estimate and return the necessary
parameters for cluster analysis visualizations for budget or expenditure
datasets of Municipality across Europe.
The vignette shows the way Cluster.OBeu
(in R and
OpenCPU environment) is fitted with datasets of OpenBudgets.eu according to the OpenBudgets.eu data
model. Detailed documentation about OpenBudgets.eu data model can be
found here
The input and the resulted object are in json format.
First you have to load the library
open_spending.cl
is designed to estimate and return the
clustering model measures of OpenBudgets.eu datasets.
The available clustering algorithms are hierarchical, kmeans from R base, pam, clara, fuzzy from cluster package and model based algorithms from mclust package. It can be used to find the appropriate clustering algorithm and/or the appropriate clustering number of the input data according to the internal and stability measures from clValid package.
The input data must be a JSON link according to the OpenBudgets.eu data
model. There are different parameters that a user could specify,
e.g. dimensions
, measured.dimensions
and
amounts
should be defined by the user, to form the
dimensions of the dataset. open_spending.cl
estimates and
returns the json data that are described with the OpenBudgets.eu data
model, using cl.analysis
function.
Input | Description |
---|---|
json_data | The json string, URL or file from Open Spending API |
dimensions | The dimensions of the input data |
amounts | The amounts of the input data |
measured.dimensions | The dimensions to which correspond amount/numeric variables |
cl.aggregate | Aggregate function of the input data |
cl.method | clustering algorithm |
cl.num | Number of clusters |
cl.dist | Distance metric |
The following table shows a sort description of the
open_spending.cl
return components:
Component | Description |
---|---|
cluster.method | Label of the clustering algorithm |
raw.data | Input data |
data.pca | Principal components |
modelparam | Clustering model specifications |
compare | Clustering measures |
The dataset in the following example is being used in OpenBudgets.eu platform and concerns the income of Aragon. in 2007.
open_spending.cl
function’s input are data as json link
and described with OpenBudgets.eu data
model.
Go to: yourserver/ocpu/test
Copy and paste the following function to the endpoint
Post
Click add parameters every time you want to add a new parameters and values.
Define the input data:
json_data
"https://apps.openbudgets.eu//api/3/cubes/aragon-2007-income__3209b/aggregate?drilldown=fundingClassification.prefLabel%7CeconomicClassification.prefLabel&aggregates=amount.sum"
(or any other json URL with the data)Define the dimensions parameter:
dimensions
"economicClassification.prefLabel"
Define the amount parameter:
amounts
"amount.sum"
Define the measured dimension parameter:
measured.dimensions
"fundingClassification.prefLabel"
You add likewise further parameters and change the default parameters
of cl.method
, cl.num
, cl.dist
,
see Cluster.OBeu reference manual for further details.
copy the /ocpu/tmp/{this_id_number}/R/.val (second on the right panel)
finally, paste
yourserver/ocpu/tmp/{this_id_number}/R/.val
on a new tab.