Posts

[Day 215] Trying out 'traditional' models on the KB project transaction fraud data

Image
 Hello :) Today is Day 215! A quick summary of today: trying out different models to classify non fraud/fraud transactions In addition to the Graph Convolutional Network model, I wanted to create some 'traditional' (non-neural net) models for better comparison and judgement.  The features I used for the below models are: numerical: amt (amount) categorical: category, merchant, city, state, job, trans_hour, trans_dow Then I downsampled the majority class (non fraud cases; just like for the GCN model). Logistic Regression Best params: {'C': 1, 'penalty': 'l1', 'solver': 'liblinear'} CatBoost Best params: {'depth': 6, 'iterations': 300, 'learning_rate': 0.3} XGBoost Best params: {'learning_rate': 0.3, 'max_depth': 6, 'n_estimators': 300, 'subsample': 0.9} RandomForest Best params: {'max_depth': None, 'min_samples_split': 2, 'n_estimators': 200} LGBMClassifier Bes...

[Day 214] The evaluation of my MLOps zoomcamp project arrived - max points

Image
 Hello :) Today is Day 214! A quick summary of today: documenting the KB project data using arrow.app small repo changes ML zoomcamp announcement I tried to find some graph documentation tool for the KB project. The most popular I could find is this arrows.app application where we can create sample nodes with edges between and add attributes with descriptions. I created the below pic using that app Also I made some small changes to the repo: the readme I added: Docker - used to containarise and self-host the below services Mlflow - used for easy model comparison during development. Can be improved by using cloud services (like GCP) for hosting, database and artifact store Mage - used for pipeline orchestration of the model training and real-time inference pipelines. Can be improved by hosting mage on the cloud Neo4j - used as a Graph database to store transaction data as nodes and edges. Can be improved by using Neo4j's AuraDB (hosted on the cloud) Kafka - used to ensure real-time ...

[Day 213] Creating a grafana dashboard for the KB project

Image
 Hello :) Today is Day 213! A quick summary of today: using Cypher to create a grafana dashboard for my neo4j database After setting up neo4j's plugin in grafana a few days ago today I decided to create a live dashboard in grafana. The result: Each graph requires using Cypher (neo4j's query language). One cool graph I was surprised I could make is the geography map which uses the long and lat of merchants where there was fraud. What else is cool is that the graph updates as new transactions come in. It can update at different intervals, but I tested the 5 second one, and as new data comes in from kafka and sent to the db, the dashboard reflects it. What is more, this time, I saved the dashboard as a json are uploaded it to github. As seen from the next pic, besides the graph, the other things I did today are a bit trivial - just updating variable names, clean up data preprocessing and make the Mage pipelines better.  The deadline for the project is 11th of Aug, so till then th...

[Day 212] Final Glaswegian TTS model

Image
 Hello :) Today is Day 212! A quick summary of today: creating a simple Glaswegian assistant app After finetuning whisper to get the final version of the Glaswegian ASR model, the next task was to do a final fine-tuning on the T5 speech model to get a final version of the Glaswegian TTS model. Well I did that today.  Here is a link to the model on HuggingFace. And its training results: Now that we have the final 2 hour dataset, I was hoping for better results. Before, the generated audio (while with a little accent) sounded robotic. First thing I had to do was fix the HuggingFace space where the previous version of the glaswegian TTS was running. The issue was related to voice embeddings, and after a quick fix ~ It was up again, and I loaded the latest glaswegian_tts model. Well now, it *does* sound better. There are cases where it is robotic, but there is definitely improvement compared to the previous version. That previous version was trained or around 30 mins of audio, co...

[Day 211] 2 hour mark !!! Glaswegian dataset goal - accomplished! + whisper-small fine-tuned

Image
 Hello :) Today is Day 211! A quick summary of today: fine-tuning the final whisper-small model for Glaswegian  automatic speech recognition (ASR) After yesterday, it the audio was 118 and I was not happy that we did not *officially* hit the 2 hour mark, so today I went on youtube and got a 3min clip from Limmy which I transcribed and added to our dataset. Here is a link to the final 2 hour Glaswegian dataset on HuggingFace. After a few months of working on this side project we hit the set goal!~ After I got the dataset I started fine-tuning whisper-small. It took around 4 hours ~ and the fine-tuned model is ready and deployed for using on HuggingFace Spaces .  Looking at the metrics, training could be improved.  As for what is next - training a Text-To-Speech model using our final dataset. This was the hard part before because the voice at the end was, while understandable, a bit robotic. So this is the next step and hopefully we get better results now.  That...

[Day 210] 118 minutes of Glaswegian accent audio clips

Image
 Hello :) Today is Day 210! A quick summary of today: final audio clips preprocessing to reach our audio dataset mark Final dataset for the glaswegian voice assistant AI ( link to HuggingFace ). Today I preprocessed the final audios from 2 of Limmy's youtube videos (Limmy accidentaly kills the city and The writer of Saw called Limmy a ...).  Just an update on how the process goes now ~  Since our transcription AI is pretty good (according to my Glaswegian speaking project partner), we pass the full raw audio to our fine-tuned whisper  model hosten on HuggingFace spaces. Then the transcript is put into a docs file (where first I check over it for obious mistakes and flag if I see something odd and cannot understand it from re-listening to the audio) and split into sensible (small) bits while listening to the audio, like: (this is the start from Limmy accidentaly kills the city) Then using an audio tool, I cut the full audio length into clips according to the cut text,...

[Day 209] Using Mage for pipeline orchestration in the KB project

Image
 Hello :) Today is Day 209! A quick summary of today: creating Mage pipelines for the KB AI competition project The repo after today Today morning/afternoon I went on a bit of a roll ~  I set up all the above pipelines in Mage. Below I will go over each one get_kaggle_data it is just one block that downloads the data for the project from Kaggle using the kaggle python package load_batch_into_neo4j Gets the loaded data from the get_kaggle_data pipeline and inserts it into neo4j. This is the fraudTrain.csv from the Kaggle website (because the fraudTest.csv will be used for the pseudo-streaming pipeline). train_gcn I tried to split this into more blocks, but at the moment the way I structured the code, the most optimal solution was to do it all at once. That is - create a torch-geometric dataset, create node and edge index, train the model, test it, and save summary info. At the moment, because everything is local, I am using mlflow just for easy comparison but later (after the ...

[Day 208] Setting up docker-services for the KB project, streaming transactions, and the Scottish dataset

Image
 Hello :) Today is Day 208! A quick summary of today: making progress with the Kukmin Bank (KB) project Scottish dataset 2hr audio mark is close First, about the KB project for the KB AI competition All code from today is on the project's repo on branch ivan . Today I managed to set up the (what I think are the) needed services going forward. I hit the Docker storage space limit a few times, so I had to compromise on complexixty. For example instead of using postgres as a db for mlflow, even using a simple sqlite3 db for this project is fine. Later, plugging in a better storage for mlflow, and its artifacts is trivial. One new thing, that was not there before is grafana. I saw online that there is a neo4j grafana plugin - so I tried to install it. At first, by default, I could not, so I looked in grafana cloud (free for 14 days) and on there, the plugin could easily be loaded, and I could easily connect to my neo4j db. However, I wanted to do it locally, so I found a way to install...

[Day 207] Finished with neo4j (for now) and thinking about fraud detection models

Image
 Hello :) Today is Day 207! A quick summary of today: setting up neo4j reading some papers on bank telemarketing classification Firstly, about the Kukmin Bank (KB) AI competition project We set up  the database on my partner's laptop insert CreditCard nodes insert Merchant nodes insert Transaction edge We also had a look at the final EDA notebook. At the moment the repo looks like: As for next steps, we will start developing models, and try to get something that can identify Fraud transactions well. And more importantly, explainability - what features help the model determine that a transaction is fraud. So we will start with some basic models like logistic reg, decision trees, random forest, then add hyperparam tuning, over/undersampling, etc. And try to get a model that detects Fraud well.  As I want to try out a GNN for this project's model. I saw there is a GNNExplainer by torch-geometric, so I need to try using it in practice and see if the explainability it provides...