GithubHelp home page GithubHelp logo

pietroluongo / haskell-clustering Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 121 KB

Haskell project focused on multidimensional points grouping and analysis

Haskell 97.31% Makefile 2.69%
machine-learning clustering multidimensional-data multidimensional-analysis neural-network k-means

haskell-clustering's Introduction

Haskell Clustering Project

About

Project from the functional programming course at UFES, Universidade Federal do Espírito Santo. This project consists on grouping points together following a previously determined specification. These rules can be found at the PDF file on the root folder of this project.

The idea behind the project is applying concepts seen in topics such as Linear Algebra and Machine Learning to a different paradigm (the functional one). That way, it is possible to compare directly topics seen in structural programming languages, such as C and C++ with their counterparts in Haskell.

Coding Standard

Function comment structure

-- Brief function description.
-- Info about function dependency (e.g. "This should be called by X").
-- Parameters:
--    firstParamName: FirstParamType -> First parameter description
--    secondParamName: SecondParamType -> Second parameter description
-- Result:
--    Type -> Result description
-- Additional notes about the function

Data type comment structure

-- Brief datatype description.
-- Fields:
	-- firstFieldName: FirstFieldType -> First field description

Parameter Names: camelCase

Function Names: camelCase

Building Instructions

There is a Makefile included with the project that will build the project properly. Build possibilities:

  • all: Standard build procedure, builds all files with optimizations.
  • all-no-optimizations: Builds the code without optimizations enabled.
  • clean: Removes compiled binaries and intermediate code.

Folder Structure

.
├── Algebra
│   ├── Group.hs
│   └── Point.hs
├── Main.hs
├── Makefile
├── README.md
└── specification.pdf

Some thoughts on the project

It is quite challenging to shift programming paradigms, as someone who has always used procedural and object-oriented languages, such as C and Java. As such, some of the concepts end up "bleeding" to the code written in what would be a purely functional code. However, i believe that it is a natural approach to try and fit what you already know into a new and different environment, and it is how you end up working with what you're given. Part of programming is being flexible enough to be able to use different tools for different jobs.

I chose to use English as the main language of this project, as i believe it enables a broader group of people to access the source code and the documentation, and it also doubles as a way to train writing in a second language. Furthermore, most programming projects are written in English, as it won't use Unicode characters and improves the homogeneity of the source code as it is easier to read code written in a single language rather than mixing variables and function names in two different languages.

The lack of a debugger in Haskell is something i definitely don't like. Also, the stack trace errors are awful. More often than not they're of absolutely no help at all on solving the simplest errors.

About commits: i prefer to micromanage commits and sometimes it may feel a bit obnoxious to have various commits with small changes. It's an habit i picked up after losing a lot of data, more than once. It wasn't very nice.

I do realize that some of the decisions i took on this project might seem like overkill (like defining a data type Point, when it could be represented as a list of numbers). This was a deliberate decision, simply because i wanted to learn as much as i could from the language, and apply as many different resources as possible to make the project expandable.

Messing with OOP concepts in functional languages is kind of a huge headache. It gives you the tools to do it, but they often feel incomplete and really like an afterthought instead of something that is, in fact, practical to use. Perhaps i'm overthinking it, but i feel like i'm writing more code to make the same procedures i'd make in very few lines on other languages. I believe it's just because i'm not used to it yet, and everything will just "click" eventually. What worries me is the lack of time to finish this project and deal with other projects at the university. I'm kind of mentally exhausted to be honest.

Well, finally finished this up. Final conclusions are that I/O in Haskell kind of sucks. Formatting the output file was a massive nightmare, but i pushed through thanks to @chamatt (thanks, dude!). It wound up being easier than i thought initally, but i kind of got stuck on the grouping algorithm for a considerable time. But i guess everything works itself out eventually, if you keep trying. Well, i guess that's about it!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.