@SimonForsberg I've taken a quite lengthy break from ML due to personal issues, but I'd like to get back into it, and I figured I should do that by applying it. Do you recommend any problems for me to apply ML to? (face recognition, etc)
@SirPython You can always start with the MNIST problem, simply googling will give you enough info, not sure what you want to do with ML though, build your own code or use an existing system and tune the parameters?
@SirPython I find that one of the most interesting problems is text analysis. Face recognition is a tough one and needs to use quite optimized Neural Network implementations to be done correctly.
I got news yesterday that it might be possible to replace my Algorithms subject at uni with something else :o
I can implement algorithms but creating your own is basically walking into hell
Only maybe I can "replace" it with a subject I've already done, for that I need to get an overview of my study programme and seeing as it has been modified over 9000 times that's pretty difficult :/
I'd basically be looking for something like that, which would condense multiple results into a single result that would eagerly return an error int he first result that occurred, or return the results if it succeeded
> lib.rs:28:10: 28:50 error: binary operation `!=` cannot be applied to type `<S as std::ops::BitAnd<usize>>::Output` [E0369] lib.rs:28 (self.data[data_index] & (1 << remainder) != 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib.rs:28:10: 28:50 help: run `rustc --explain E0369` to see a detailed explanation lib.rs:28:10: 28:50 note: an implementation of `std::cmp::PartialEq` might be missing for `<S as std::ops::BitAnd<usize>>::Output` lib.rs:28 (self.data[data_index] & (1 << remainder) != 0)
WHY
impl<S> Index<usize> for BitVector<S>
where S: Sized + BitAnd<usize> + Not + Eq {
type Output = bool;
fn index(&self, index: usize) -> &bool {
let data_index = index / (std::mem::size_of::<S>() * 8);
let remainder = index % (std::mem::size_of::<S>() * 8);
(self.data[data_index] & (1 << remainder) != 0)
}
}
I'm in the process of implementing a Bit Vector class as an exercise, however only knowing Rust for less than a week I run into trouble with the following code:
use std::cmp::Eq;
use std::ops::BitAnd;
use std::ops::Index;
use std::ops::Not;
struct BitVector<S = usize>
where S: Sized + BitAnd<
You've said that S must implement Eq, but not that it needs PartialEq in your where clause. Adding that should allow the function to use !=.
It's worth reading the compiler error carefully; it's trying to say just that.
This particular error here, in simple terms, means that the Output of BitAnding S and usize does not implement PartialEq. One fix would be to add a constraint that S's BitAnd<usize>s Output is S:
BitAnd<usize, Output = S>
After this, you'll run into another error because you're comparing the v...
Ah, BitAnd<usize, Output = S> also makes sense, I perform the bit-and with usize which is (1 << remainder) (so it's not a float?) and have an S as output
it was more the demonstration that once you try and use mutable properties in Rust, it really makes it obvious just how much you have to make mutable for that to work
I'm not saying "this code is bad or good", I'm just saying that rust points out exactly what you are making mutable, which is pretty cool
if I wrote code lke that in OOP, I wouldn't care. But after seeing just how much can be changed at any point by any thing it really makes me care about immutability
no, you can use super:: if your tests are in ad iffernt module and the main code isn't in one
also, yes, now I worked io ut
in the first one player takes ownership of the position and nothing else can use it
in the second one, the player doesn't taken ownership of position so anyone can access it, but the Position struct is collected when the Playero ne is (I think)
mod tests {
use super::*;
fn test_with_capacity() {
Doesn't work
> lib.rs:71:27: 71:58 error: failed to resolve. Use of undeclared type or module `BitVector` [E0433] lib.rs:71 let vec_32_1024 = BitVector::<u32>::with_capacity(1024);
> lib.rs:71:27: 71:58 error: no associated item named `with_capacity` found for type `BitVector<u32>` in the current scope lib.rs:71 let vec_32_1024 = BitVector::<u32>::with_capacity(1024); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ah maybe not pub
So the unit tests actually test pub/"non-pub" as well? Cool!
> lib.rs:69:27: 69:65 error: no associated item named `with_capacity` found for type `BitVector<u32>` in the current scope lib.rs:69 let vec_32_1024 = super::BitVector::<u32>::with_capacity(1024); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wtf doesn't work
It works if I don't hae the ::<u32> there
I'm not sure if BitVector<S = usize> is doing what I think it does
Oh hmm
> lib.rs:71:27: 71:58 error: no associated item named `with_capacity` found for type `BitVector<u32>` in the current scope lib.rs:71 let vec_32_1024 = BitVector::<u32>::with_capacity(1024); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib.rs:71:27: 71:58 note: the method `with_capacity` exists but the following trait bounds were not satisfied: `u32 : std::ops::BitAnd<usize>`
I'm trying to learn Rust and am a beginner. How does one go about implementing a generic version of Fibonacci number generation without using Copy trait in Rust? My code is given below.
I had to use Copy trait, otherwise the compiler would complain cannot move out of borrowed content [E0507] in...
Thinking about Macros in Rust again, they actually make lots of sense: It is much better to use a macro for any non-implementation-detail private method because it didn't really belong in that class as a method in the first place
[skiwi2/bit-vector]skiwi2 pushed commit 1dfcc8e6 to master: BitVector now implements the Zero and One traits for the num package instead of custom traits and also implements the Unsigned trait