This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT A.* | |
FROM film_actor A | |
INNER JOIN (SELECT film_id | |
FROM film_actor | |
GROUP BY film_id | |
HAVING COUNT(*) > 1) B | |
ON A.film_id = B.film_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://dba.stackexchange.com/questions/161901/select-pairs-a-b-excluding-b-a-with-same-value | |
SELECT | |
p1.Id,p2.Id,p1.Name | |
FROM Pairs p1 | |
JOIN Pairs p2 | |
ON p1.Name = p2.Name | |
AND p1.Id < p2.Id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
p1.actor_id act1,p2.actor_id act2, p2.film_id | |
FROM film_actor p1 | |
JOIN film_actor p2 | |
ON p1.film_id = p2.film_id | |
AND p1.actor_id < p2.actor_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH subq (actor_1_id, actor_2_id, film_id) AS | |
(SELECT p1.actor_id, p2.actor_id, p2.film_id | |
FROM film_actor p1 | |
JOIN film_actor p2 | |
ON p1.film_id = p2.film_id | |
AND p1.actor_id < p2.actor_id | |
) | |
SELECT * | |
FROM subq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH subq (actor_1_id, actor_2_id, film_id) AS | |
(SELECT p1.actor_id, p2.actor_id, p2.film_id | |
FROM film_actor p1 | |
JOIN film_actor p2 | |
ON p1.film_id = p2.film_id | |
AND p1.actor_id < p2.actor_id | |
) | |
SELECT actor_1_id, actor_2_id, COUNT(film_id) AS count | |
FROM subq | |
GROUP BY actor_1_id, actor_2_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH subq1 (actor_1_id, actor_2_id, film_id) AS | |
(SELECT p1.actor_id, p2.actor_id, p2.film_id | |
FROM film_actor p1 | |
JOIN film_actor p2 | |
ON p1.film_id = p2.film_id | |
AND p1.actor_id < p2.actor_id | |
) | |
SELECT subq3.actor_1_id, subq3.actor_2_id, subq1.film_id | |
FROM subq1 | |
INNER JOIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH subq1 (actor_1_id, actor_2_id, film_id) AS | |
(SELECT p1.actor_id, p2.actor_id, p2.film_id | |
FROM film_actor p1 | |
JOIN film_actor p2 | |
ON p1.film_id = p2.film_id | |
AND p1.actor_id < p2.actor_id | |
) | |
SELECT | |
CONCAT(a_1.first_name, ' ' , a_1.last_name) AS first_actor, | |
CONCAT(a_2.first_name, ' ' ,a_2.last_name) AS second_actor, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- All credit to CodeWars users: lgtech, SoniaGG, Cerynna, Jeremy44, rickiquin, yurak | |
with top_pair as ( | |
select a1.actor_id as id1, a2.actor_id as id2 | |
from film_actor a1 | |
inner join film_actor a2 on a1.film_id=a2.film_id | |
where a1.actor_id <> a2.actor_id | |
group by a1.actor_id, a2.actor_id | |
order by count(a1.film_id) desc | |
limit 1 | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_image_data(files): | |
IMAGE_FILE_ROOT = './data/bee_imgs/' | |
return np.asanyarray([imageio.imread("{}{}".format(IMAGE_FILE_ROOT, file)) for file in files]) | |
def show_image(image, ax = plt, title = None, show_size = False): | |
ax.imshow(image) | |
if title: | |
ax.set_title(title) | |
if not show_size: | |
ax.tick_params(bottom = False, left = False, labelbottom = False, labelleft = False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kernel_size = 3 | |
dropout = .5 | |
activation_func = "relu" | |
input_shape = (54, 50, 3) | |
conv__filters_1 = 32 | |
conv__filters_2 = 48 | |
conv__filters_3 = 64 | |
density_units_1 = 256 | |
density_units_2 = 64 |